-
Notifications
You must be signed in to change notification settings - Fork 0
Fix schema types seriallization #65
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
Conversation
…datory specification for all types
JaCoCo code coverage report - springdoc-openapi-scala-1
|
JaCoCo code coverage report - springdoc-openapi-scala-2
|
I am not 100% sure what this PR tries to fix, could you please provide an example what is wrong currently? |
@jakipatryk Added some before vs after examples. |
library/src/main/scala/za/co/absa/springdocopenapiscala/OpenAPIScalaCustomizer.scala
Outdated
Show resolved
Hide resolved
library/src/main/scala/za/co/absa/springdocopenapiscala/OpenAPIModelRegistration.scala
Show resolved
Hide resolved
We noticed that in our generated swagger docs (both api-docs endpoint and Swagger UI), certain types were missing from the properties, notably string or boolean. For some reason, integer types were present. Alex' examples are extracts from the api-docs endpoint |
Strong data type serialization is lost because Swagger requires use of
Schema[_]
subtypes when modeling primitives, maps and arrays instead of the baseSchema[_]
class even if they have the same properties.Map
,List
,String
,Boolean
which were incorrectly serialized toAny
typeTested using openapi Python generator. Verified types are now strongly typed and optional and mandatory fields are preseved as expected.
Test evidence
Example 1
Current implementation:
Notice above the absence of
type
for all properties resulting in the properties defaulting toAny
in the generated OpenAPI JSONAfter the fix:
Example 2
Current implementation:
After the fix: