Skip to content

Commit

Permalink
Fixed formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
QrystaL committed Jan 14, 2025
1 parent c86e65a commit 11e05c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/SwaggerProvider.DesignTime/v3/DefinitionCompiler.fs
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,16 @@ type DefinitionCompiler(schema: OpenApiDocument, provideNullable) as this =
match schemaObj.AllOf.Count > 0 with
| true ->
schemaObj.AllOf
|> Seq.append [schemaObj]
|> Seq.collect (fun x -> x.Properties)
|> Seq.append [ schemaObj ]
|> Seq.collect(fun x -> x.Properties)
| false -> schemaObj.Properties

let schemaObjRequired =
match schemaObj.AllOf.Count > 0 with
| true ->
schemaObj.AllOf
|> Seq.append [schemaObj]
|> Seq.collect (fun x -> x.Required)
|> Seq.append [ schemaObj ]
|> Seq.collect(fun x -> x.Required)
|> System.Collections.Generic.HashSet
:> System.Collections.Generic.ISet<string>
| false -> schemaObj.Required
Expand Down
6 changes: 4 additions & 2 deletions tests/SwaggerProvider.Tests/Schema.Parser.Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ let ``Parse PetStore``() =
)

[<Fact>]
let ``Add definition for schema with only allOf properties`` () =
let ``Add definition for schema with only allOf properties``() =
let definitions =
__SOURCE_DIRECTORY__ + "/../SwaggerProvider.ProviderTests/Schemas/v3/issue255.yaml"
__SOURCE_DIRECTORY__
+ "/../SwaggerProvider.ProviderTests/Schemas/v3/issue255.yaml"
|> File.ReadAllText
|> V3.testSchema

definitions |> shouldHaveLength 1
definitions[0].GetDeclaredProperty("FirstName") |> shouldNotEqual null

Expand Down

0 comments on commit 11e05c6

Please sign in to comment.