Skip to content

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

@YousefHaggy

Description

@YousefHaggy

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"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions