Fix schema types seriallization#65
Merged
AlexGuzmanAtAbsa merged 12 commits intomainfrom Jul 24, 2025
Merged
Conversation
…datory specification for all types
JaCoCo code coverage report - springdoc-openapi-scala-1
|
JaCoCo code coverage report - springdoc-openapi-scala-2
|
Collaborator
|
I am not 100% sure what this PR tries to fix, could you please provide an example what is wrong currently? |
Collaborator
Author
|
@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
Contributor
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 |
library/src/main/scala/za/co/absa/springdocopenapiscala/OpenAPIModelRegistration.scala
Outdated
Show resolved
Hide resolved
kevinwallimann
approved these changes
Jul 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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,Booleanwhich were incorrectly serialized toAnytypeTested 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
typefor all properties resulting in the properties defaulting toAnyin the generated OpenAPI JSONAfter the fix:
Example 2
Current implementation:
After the fix: