Skip to content

V1 - SwaggerCompatConverter - Bad mapping in "Contact" object #1451

Open
@phiz71

Description

@phiz71

Hi,
according to the 1.2 version of Swagger specs, info.contact is used for email.
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/1.2.md#513-info-object

However, in the SwaggerCompatConverter, the contact field is put into url
https://github.com/swagger-api/swagger-parser/blob/v1/modules/swagger-compat-spec-parser/src/main/java/io/swagger/parser/SwaggerCompatConverter.java#L554-L555

            Contact contact = null;
            if (apiInfo.getContact() != null) {
                contact = new Contact()
                        .url(apiInfo.getContact());
            }

It should be "email".

As a consequence, when I parse this swagger descriptor in version 1.2 with OpenAPIParser:

{
  "apiVersion": "1.2.3",
  "swaggerVersion": "1.2",
  "info": {
    "title": "My title",
    "description": "My description",
    "termsOfServiceUrl": "http://swagger.io/terms/",
    "contact": "[email protected]",
    "license": "Apache 2.0",
    "licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.html"
  }
...

I get this OpenAPI descriptor:

openapi: 3.0.1
info:
  title: My title
  description: My description
  termsOfService: http://swagger.io/terms/
  contact:
    url: [email protected]
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.2.3
...

which is not valid, since info.contact.url must be in the format of a URL (https://swagger.io/specification/#contact-object)

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