Closed YousefHaggy closed 1 week ago
@frantuma Seeing that you worked on SchemaResolution PRs, do you think this change would make sense for SchemaResolution.INLINE? I could make a PR
Thanks!
As mentioned in wiki SchemaResolution
only applies to OAS 3.0 specification, however the behaviour also occurred with OAS 3.0 specs (openapi31 = false
) and this is fixed by this #4784 .
apply-schema-resolution=true
which causes the SchemaResolution
to be partially processed also for 3.1 specs.Closing ticket, please reopen if you're still experiencing issues
Thanks @frantuma, I appreciate this. Could applySchemaResolution
be moved to a function call in ModelResolver so that we can just override it in our custom resolver? Setting System properties is unideal in our workflow. I can open a PR for that if you think it's reasonable
protected boolean shouldApplySchemaResolution(){
return !openapi31 ||
(Boolean.parseBoolean(System.getProperty(Schema.APPLY_SCHEMA_RESOLUTION_PROPERTY, "false")) ||
Boolean.parseBoolean(System.getenv(Schema.APPLY_SCHEMA_RESOLUTION_PROPERTY)));
}
@YousefHaggy the flag has been added as quick solution for such edge use case, what I meant with partially processed also for 3.1 specs.
is that to have it fully working more work is needed, both adding the option along all the involved code in different modules (basically similarly to what done for the schemaResolution
option, and also ensure that behavior is correct.
That said, a PR to allow the same outcome currently obtained with the system property by updating ModelResolver is welcome!
@frantuma Made a small PR to obtain the same outcome but move the check to a method to allow clients to override the default behavior https://github.com/swagger-api/swagger-core/pull/4791
Having an issue with
ModelResolver
when resolving Array typesSay I have CustomObject.class, trying to resolve the schema of it's Array type class results in a Array schema with a reference
Resulting schema component:
SchemaResolution.INLINE doesn't inline these types. When I resolve a schema with that option, any properties that are array types on the class, ex: List, CustomObject[], get converted to Array reference schemas.
Is there anyways to generate fully inline Schemas when there are Array types? For SchemaResolution.INLINE, I would expect my above example to resolve as: