Skip to content

[BUG] [Spring] Defining a schema called Resource leads in a wrong generated model using org.springframework.core.io.Resource instead #1888

@gerardbosch

Description

@gerardbosch
Description

I am using openapi-generator version 3.3.0 as the openapi-generator-maven-plugin for Spring language.

If I define an OpenAPI schema called Resource, like the following,

    Resource:
      type: object
      properties:
        description:
          type: string
        grants:
          type: object
          additionalProperties:
            type: boolean
        id:
          type: string
        publicId:
          type: string
        publicIdType:
          type: string
          enum:
            - IBAN
            - BBAN
            - MSISDN
            - PAN

no Resource model class is genrated. And what I get is the following: the schemas that reference or contain the avobe Resource, what actually have is the following example:

  @JsonProperty("resources")
  @Valid
  private List<org.springframework.core.io.Resource> resources = new ArrayList<>();

So it looks like that instead of generating an object model called Resource it is using a Spring type called Resource.

I can only think this is a bug. Could someone confirm it?

Very happy with the generator by the way.
Thanks!

openapi-generator version

3.3.0

OpenAPI declaration file content or url

A little fragment of the schema producing the issue:

    Resource:
      type: object
      properties:
        description:
          type: string
        grants:
          type: object
          additionalProperties:
            type: boolean
        id:
          type: string
        publicId:
          type: string
        publicIdType:
          type: string
          enum:
            - IBAN
            - BBAN
            - MSISDN
            - PAN
Command line used for generation

mvn clean install

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions