-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignored schema components while generating the types #183
Comments
About my comment:
Using dotnet 5.0.200 and a console project with default settings <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Content Include="petstore.json" />
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SwaggerProvider" Version="1.0.0-beta3" />
</ItemGroup>
</Project> Building the project worked but I get the design-time error above when hovering over the reported error in visual studio |
in your "Pet": {
"type": "object",
"additionalProperties": {
"type": "integer",
"format": "int64"
}, compare it with spec for dictionaries https://swagger.io/docs/specification/data-models/dictionaries/
Swagget/OpenAPI TPs model enums as string, that is why there is no type - #146
What IDE & version do you use? |
Hi @sergey-tihon I must have misunderstood the specifications of additional properties because object types using additionalProperties are also allowed to have arbitrary object properties alongside additionalProperties 🤔 at least the schema parsers and validators are perfectly fine when reading the schema and don't report any error. Maybe I could simplify my implementation 😅 As for the VS type provider error, I will try to see what's going on there, maybe a caching issue because I installed 1.0.0beta3 after 0.12.0 and Vs didn't dispose of loaded assemblies |
This is what I mean by object properties + additional properties "Lang": {
"type": "object",
"required": [
"defaultLang"
],
"properties": {
"defaultLang": {
"type": "string"
}
},
"additionalProperties": {
"type": "string"
}
} The type type Lang =
{ defaultLang: string
additionalProperties: Map<string, string> } It makes the JSON conversion somewhat more complicated but I already took care of that. As for the issue, it is resolved since the my schema was a bit too contrived to begin with and the type provider doesn't generate specialized enums |
Description
While working on Hawaii, I am using a modified PetStore schema and testing with the type provider to see how the results look like and whether I am on the right direction.
For the following schema, the
Pet
type is completely ignored:Besides
Pet
, the globalUserRole
enum seems to also be ignore :and references to that
UserRole
type in other components (such asUser.Role
) is resolved to a string instead of an enumRepro steps
Please provide the steps required to reproduce the problem
SwaggerProvider v0.12.0
package (1.0.0-beta3 didn't work for me, causing a design time error)Pet
type andUserRole
typeExpected behavior
Types are not ignored
Actual behavior
Types are ignored
Known workarounds
None
Related information
The text was updated successfully, but these errors were encountered: