You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It’s basically two issues in one: the inability to parse the openapi v3 schema from https://cloud.squidex.io/ (a very nice .net CMS by the way)
Here I provide a script which reproduces the issues, see the comment./
For the nullable named property, re-serializing the schema with Microsoft.OpenApi is a workaround (hence the outputSchemaV3 function to do that.
Anyway, “subcomponent” schema (subschema?) are not parsed or correctly taken into account, see the last comment.
#r "nuget: Microsoft.OpenApi.Readers"
#r "nuget: Microsoft.OpenApi"openMicrosoft.OpenApi.ReadersopenMicrosoft.OpenApi.WritersopenSystem.IOletoutputSchemaV3 origin converted =letconvertedPath=__SOURCE_DIRECTORY__+"/"+ converted
use convertedStream = File.Create(convertedPath)use streamWriter =new StreamWriter(convertedStream)letjsonWriter=new OpenApiJsonWriter(streamWriter)letopenApiDocumentReader=new OpenApiStreamReader()letoriiginPath=__SOURCE_DIRECTORY__+"/"+ origin
use readerStream = File.OpenRead(oriiginPath)
readerStream |> openApiDocumentReader.Read |> fst |>_.SerializeAsV3(jsonWriter)
streamWriter.Flush()// Ensure all data is written to the file
outputSchemaV3 "nullableproperty-schema.json""converted-schema.json"
outputSchemaV3 "nullablepropertyandcomponent-schema.json""convertedcomponent-schema.json"
#r "nuget: SwaggerProvider"openSwaggerProvider[<Literal>]letschemaPath=__SOURCE_DIRECTORY__+"/nullableproperty-schema.json"[<Literal>]letconvertedSchemaPath=__SOURCE_DIRECTORY__+"/converted-schema.json"[<Literal>]letconvertedComponentSchemaPath=__SOURCE_DIRECTORY__+"/convertedcomponent-schema.json"// type BlogApi = OpenApiClientProvider<schemaPath>// The type provider 'SwaggerProvider.OpenApiClientTypeProvider' reported an error: Schema parse errors:// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1pages~1{id}/get/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1pages~1{id}/post/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1pages~1{id}/put/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1pages~1{id}/patch/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1pages~1{id}/delete/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1pages~1{id}~1{version}/get/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1pages~1{id}~1{version}/get/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1pages~1{id}~1validity/get/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1pages~1{id}~1defaults/put/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1pages~1{id}~1status/put/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1posts~1{id}/get/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1posts~1{id}/post/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1posts~1{id}/put/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1posts~1{id}/patch/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1posts~1{id}/delete/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1posts~1{id}~1{version}/get/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1posts~1{id}~1{version}/get/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1posts~1{id}~1validity/get/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1posts~1{id}~1defaults/put/parameters @// nullable is not a valid property at #/paths/~1api~1content~1fradav-blog~1posts~1{id}~1status/put/parameters @typeBlogApi= OpenApiClientProvider<convertedSchemaPath>letpage= BlogApi.PagesContentDto()
page.Data <- BlogApi.PagesDataDto()
page.Data.Title <- Map ["iv","Hello, world!"]// OKtypeBlogApiComponent= OpenApiClientProvider<convertedComponentSchemaPath>letalternativeTitleComponent=
BlogApiComponent.PagesDataDto_AlternativeTitle_Item()// alternativeTitleComponent.Title <- Map [ "iv", "Hello, world!" ] // Not OK, Title should be a property of the component
The text was updated successfully, but these errors were encountered:
It’s basically two issues in one: the inability to parse the openapi v3 schema from https://cloud.squidex.io/ (a very nice .net CMS by the way)
Here I provide a script which reproduces the issues, see the comment./
For the nullable named property, re-serializing the schema with Microsoft.OpenApi is a workaround (hence the
outputSchemaV3
function to do that.Anyway, “subcomponent” schema (subschema?) are not parsed or correctly taken into account, see the last comment.
convertedcomponent-schema.json
nullablepropertyandcomponent-schema.json
converted-schema.json
nullableproperty-schema.json
The text was updated successfully, but these errors were encountered: