Skip to content

Commit 354de2d

Browse files
authored
Merge branch 'main' into fix-list-query-stringification
2 parents 5b763f8 + d7440bb commit 354de2d

8 files changed

Lines changed: 563 additions & 54 deletions

File tree

ConsumePlugin/ConsumePlugin.fsproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,16 @@
118118
<Compile Include="Generated2SwaggerGitea.fs">
119119
<MyriadFile>GeneratedSwaggerGitea.fs</MyriadFile>
120120
</Compile>
121+
<!-- Regression test: this spec defines a type named "Type1", which must not
122+
collide with the names invented for anonymous inline schemas. If they
123+
collide, this project fails to compile with a duplicate-definition error. -->
124+
<None Include="swagger-anonymous-types.json" />
125+
<Compile Include="GeneratedSwaggerAnonymousTypes.fs">
126+
<MyriadFile>swagger-anonymous-types.json</MyriadFile>
127+
<MyriadParams>
128+
<ClassName>AnonymousTypes</ClassName>
129+
</MyriadParams>
130+
</Compile>
121131
</ItemGroup>
122132

123133
<ItemGroup>

ConsumePlugin/Generated2SwaggerGitea.fs

Lines changed: 290 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27373,6 +27373,138 @@ module LanguageStatisticsJsonSerializeExtension =
2737327373
)
2737427374

2737527375
node :> _
27376+
namespace Gitea
27377+
27378+
open WoofWare.Myriad.Plugins
27379+
27380+
/// Module containing JSON serializing extension members for the Type9 type
27381+
[<AutoOpen>]
27382+
module Type9JsonSerializeExtension =
27383+
/// Extension methods for JSON parsing
27384+
type Type9 with
27385+
27386+
/// Serialize to a JSON node
27387+
static member toJsonNode (input : Type9) : System.Text.Json.Nodes.JsonNode =
27388+
let node = System.Text.Json.Nodes.JsonObject ()
27389+
27390+
do
27391+
for KeyValue (key, value) in input.AdditionalProperties do
27392+
node.Add (key, id value)
27393+
27394+
node.Add (
27395+
"data",
27396+
(input.Data
27397+
|> (fun field ->
27398+
match field with
27399+
| None -> None
27400+
| Some field ->
27401+
(field
27402+
|> (fun field ->
27403+
let arr = System.Text.Json.Nodes.JsonArray ()
27404+
27405+
for mem in field do
27406+
arr.Add (Team.toJsonNode mem)
27407+
27408+
arr
27409+
))
27410+
:> System.Text.Json.Nodes.JsonNode
27411+
|> Some
27412+
)
27413+
|> Option.toObj)
27414+
)
27415+
27416+
node.Add (
27417+
"ok",
27418+
(input.Ok
27419+
|> (fun field ->
27420+
match field with
27421+
| None -> None
27422+
| Some field ->
27423+
(field
27424+
|> (fun field ->
27425+
let field = System.Text.Json.Nodes.JsonValue.Create<bool> field
27426+
27427+
(match field with
27428+
| null ->
27429+
raise (
27430+
System.ArgumentNullException
27431+
"Expected type bool to be non-null, but received a null value when serialising"
27432+
)
27433+
| field -> field)
27434+
))
27435+
:> System.Text.Json.Nodes.JsonNode
27436+
|> Some
27437+
)
27438+
|> Option.toObj)
27439+
)
27440+
27441+
node :> _
27442+
namespace Gitea
27443+
27444+
open WoofWare.Myriad.Plugins
27445+
27446+
/// Module containing JSON serializing extension members for the Type10 type
27447+
[<AutoOpen>]
27448+
module Type10JsonSerializeExtension =
27449+
/// Extension methods for JSON parsing
27450+
type Type10 with
27451+
27452+
/// Serialize to a JSON node
27453+
static member toJsonNode (input : Type10) : System.Text.Json.Nodes.JsonNode =
27454+
let node = System.Text.Json.Nodes.JsonObject ()
27455+
27456+
do
27457+
for KeyValue (key, value) in input.AdditionalProperties do
27458+
node.Add (key, id value)
27459+
27460+
node.Add (
27461+
"data",
27462+
(input.Data
27463+
|> (fun field ->
27464+
match field with
27465+
| None -> None
27466+
| Some field ->
27467+
(field
27468+
|> (fun field ->
27469+
let arr = System.Text.Json.Nodes.JsonArray ()
27470+
27471+
for mem in field do
27472+
arr.Add (User.toJsonNode mem)
27473+
27474+
arr
27475+
))
27476+
:> System.Text.Json.Nodes.JsonNode
27477+
|> Some
27478+
)
27479+
|> Option.toObj)
27480+
)
27481+
27482+
node.Add (
27483+
"ok",
27484+
(input.Ok
27485+
|> (fun field ->
27486+
match field with
27487+
| None -> None
27488+
| Some field ->
27489+
(field
27490+
|> (fun field ->
27491+
let field = System.Text.Json.Nodes.JsonValue.Create<bool> field
27492+
27493+
(match field with
27494+
| null ->
27495+
raise (
27496+
System.ArgumentNullException
27497+
"Expected type bool to be non-null, but received a null value when serialising"
27498+
)
27499+
| field -> field)
27500+
))
27501+
:> System.Text.Json.Nodes.JsonNode
27502+
|> Some
27503+
)
27504+
|> Option.toObj)
27505+
)
27506+
27507+
node :> _
2737627508

2737727509
namespace Gitea
2737827510

@@ -41543,6 +41675,128 @@ module LanguageStatisticsJsonParseExtension =
4154341675
{
4154441676
AdditionalProperties = arg_0
4154541677
}
41678+
namespace Gitea
41679+
41680+
/// Module containing JSON parsing extension members for the Type9 type
41681+
[<AutoOpen>]
41682+
module Type9JsonParseExtension =
41683+
/// Extension methods for JSON parsing
41684+
type Type9 with
41685+
41686+
/// Parse from a JSON node.
41687+
static member jsonParse (node : System.Text.Json.Nodes.JsonNode) : Type9 =
41688+
let arg_2 =
41689+
match node.["ok"] |> Option.ofObj with
41690+
| None -> None
41691+
| Some v -> v.AsValue().GetValue<System.Boolean> () |> Some
41692+
41693+
let arg_1 =
41694+
match node.["data"] |> Option.ofObj with
41695+
| None -> None
41696+
| Some v ->
41697+
v.AsArray ()
41698+
|> Seq.map (fun elt ->
41699+
(match elt with
41700+
| null ->
41701+
raise (
41702+
System.ArgumentNullException
41703+
"Expected element of array (element type Team) to be non-null, but found a null element"
41704+
)
41705+
| elt -> Team.jsonParse elt)
41706+
)
41707+
|> List.ofSeq
41708+
|> Some
41709+
41710+
let arg_0 =
41711+
let result =
41712+
System.Collections.Generic.Dictionary<string, System.Text.Json.Nodes.JsonNode> ()
41713+
41714+
let node = node.AsObject ()
41715+
41716+
for KeyValue (key, value) in node do
41717+
if key = "data" || key = "ok" then
41718+
()
41719+
else
41720+
result.Add (
41721+
key,
41722+
match node.[key] |> Option.ofObj with
41723+
| None ->
41724+
raise (
41725+
System.Collections.Generic.KeyNotFoundException (
41726+
sprintf "Required key '%s' not found on JSON object" (key)
41727+
)
41728+
)
41729+
| Some node -> node
41730+
)
41731+
41732+
result
41733+
41734+
{
41735+
AdditionalProperties = arg_0
41736+
Data = arg_1
41737+
Ok = arg_2
41738+
}
41739+
namespace Gitea
41740+
41741+
/// Module containing JSON parsing extension members for the Type10 type
41742+
[<AutoOpen>]
41743+
module Type10JsonParseExtension =
41744+
/// Extension methods for JSON parsing
41745+
type Type10 with
41746+
41747+
/// Parse from a JSON node.
41748+
static member jsonParse (node : System.Text.Json.Nodes.JsonNode) : Type10 =
41749+
let arg_2 =
41750+
match node.["ok"] |> Option.ofObj with
41751+
| None -> None
41752+
| Some v -> v.AsValue().GetValue<System.Boolean> () |> Some
41753+
41754+
let arg_1 =
41755+
match node.["data"] |> Option.ofObj with
41756+
| None -> None
41757+
| Some v ->
41758+
v.AsArray ()
41759+
|> Seq.map (fun elt ->
41760+
(match elt with
41761+
| null ->
41762+
raise (
41763+
System.ArgumentNullException
41764+
"Expected element of array (element type User) to be non-null, but found a null element"
41765+
)
41766+
| elt -> User.jsonParse elt)
41767+
)
41768+
|> List.ofSeq
41769+
|> Some
41770+
41771+
let arg_0 =
41772+
let result =
41773+
System.Collections.Generic.Dictionary<string, System.Text.Json.Nodes.JsonNode> ()
41774+
41775+
let node = node.AsObject ()
41776+
41777+
for KeyValue (key, value) in node do
41778+
if key = "data" || key = "ok" then
41779+
()
41780+
else
41781+
result.Add (
41782+
key,
41783+
match node.[key] |> Option.ofObj with
41784+
| None ->
41785+
raise (
41786+
System.Collections.Generic.KeyNotFoundException (
41787+
sprintf "Required key '%s' not found on JSON object" (key)
41788+
)
41789+
)
41790+
| Some node -> node
41791+
)
41792+
41793+
result
41794+
41795+
{
41796+
AdditionalProperties = arg_0
41797+
Data = arg_1
41798+
Ok = arg_2
41799+
}
4154641800

4154741801
namespace Gitea
4154841802

@@ -44899,7 +45153,22 @@ module Gitea =
4489945153
let! response = client.SendAsync (httpMessage, ct) |> Async.AwaitTask
4490045154
let response = response.EnsureSuccessStatusCode ()
4490145155
use response = response
44902-
return ()
45156+
let! responseStream = response.Content.ReadAsStreamAsync ct |> Async.AwaitTask
45157+
45158+
let! jsonNode =
45159+
System.Text.Json.Nodes.JsonNode.ParseAsync (responseStream, cancellationToken = ct)
45160+
|> Async.AwaitTask
45161+
45162+
let jsonNode =
45163+
(match jsonNode with
45164+
| null ->
45165+
raise (
45166+
System.ArgumentNullException
45167+
"Response from server was the JSON null object; expected a non-nullable type Type9"
45168+
)
45169+
| jsonNode -> jsonNode)
45170+
45171+
return Type9.jsonParse jsonNode
4490345172
}
4490445173
|> (fun a -> Async.StartAsTask (a, ?cancellationToken = ct))
4490545174

@@ -55050,7 +55319,8 @@ module Gitea =
5505055319
let! response = client.SendAsync (httpMessage, ct) |> Async.AwaitTask
5505155320
let response = response.EnsureSuccessStatusCode ()
5505255321
use response = response
55053-
return ()
55322+
let! responseString = response.Content.ReadAsStringAsync ct |> Async.AwaitTask
55323+
return responseString
5505455324
}
5505555325
|> (fun a -> Async.StartAsTask (a, ?cancellationToken = ct))
5505655326

@@ -57293,7 +57563,8 @@ module Gitea =
5729357563
let! response = client.SendAsync (httpMessage, ct) |> Async.AwaitTask
5729457564
let response = response.EnsureSuccessStatusCode ()
5729557565
use response = response
57296-
return ()
57566+
let! responseString = response.Content.ReadAsStringAsync ct |> Async.AwaitTask
57567+
return responseString
5729757568
}
5729857569
|> (fun a -> Async.StartAsTask (a, ?cancellationToken = ct))
5729957570

@@ -59940,7 +60211,22 @@ module Gitea =
5994060211
let! response = client.SendAsync (httpMessage, ct) |> Async.AwaitTask
5994160212
let response = response.EnsureSuccessStatusCode ()
5994260213
use response = response
59943-
return ()
60214+
let! responseStream = response.Content.ReadAsStreamAsync ct |> Async.AwaitTask
60215+
60216+
let! jsonNode =
60217+
System.Text.Json.Nodes.JsonNode.ParseAsync (responseStream, cancellationToken = ct)
60218+
|> Async.AwaitTask
60219+
60220+
let jsonNode =
60221+
(match jsonNode with
60222+
| null ->
60223+
raise (
60224+
System.ArgumentNullException
60225+
"Response from server was the JSON null object; expected a non-nullable type Type10"
60226+
)
60227+
| jsonNode -> jsonNode)
60228+
60229+
return Type10.jsonParse jsonNode
5994460230
}
5994560231
|> (fun a -> Async.StartAsTask (a, ?cancellationToken = ct))
5994660232

0 commit comments

Comments
 (0)