Skip to content

Swagger deserializer ignores JsonSchema.types() for v3.1.0 #1821

@jokoroukwu

Description

@jokoroukwu

Consider the following schema:

Rule:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        condition:
          type: string
        order:
          type: integer
        enabled:
          type: boolean
        actions:
          type: array
          description: List of actions launched on rule execution
          items:
            $ref: '#/components/schemas/ActionDescriptor'
        version:
          type: integer
          description: Version counter

This schema is deserialized into JsonSchema.
The type is present in JsonSchema.types but for some reason the actual JsonSchema.type is set to "object".
image

I've found that the object type is set in ResolveFully.resolveSchema()
if (property.getProperties() != model.getProperties()) { if (property.getType() == null) { property.setType("object"); }

Also if the open api is of version 3.1 which is in my case then OpenAPIDeserializer.getJsonSchema() is being invoked which eventually sets type via schema.addType(typeString);.
However If open api version is different then 'OpenAPIDeserializer.getSchema()' is being invoked and in this case the type is set via schema.setType(value);

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