Skip to content
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

OpenAPI 3.1 - SchemaResolution.INLINE not working with Array Type objects #4771

Open
YousefHaggy opened this issue Oct 28, 2024 · 1 comment

Comments

@YousefHaggy
Copy link

YousefHaggy commented Oct 28, 2024

Having an issue with ModelResolver when resolving Array types

Say I have CustomObject.class, trying to resolve the schema of it's Array type class results in a Array schema with a reference

ModelResolver resolver = new ModelResolver(mapper).openapi31(true);
resolver.setSchemaResolution(SchemaResolution.INLINE);
context = new ModelConverterContextImpl(resolver);
context.resolve(new AnnotatedType().type(CustomObject[].class));

Resulting schema component:

{
  "items": {
    "$ref": "#/components/schemas/CustomObject"
   },
  type": "array"
}

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:

{
  "items": {
    "type": "object",
     "properties": {
       ...
      }
   },
  type": "array"
}
@YousefHaggy
Copy link
Author

YousefHaggy commented Oct 29, 2024

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant