Skip to content

Unable to remove contact from info #419

@vaibhavatul47

Description

@vaibhavatul47

I don't want terms of service, contact, license fields in info of my api-documentation output. Why are these fields generated ? I am using open_api format for documentation.

open_api.yml

swagger: '2.0'
info:
  title: My title
  description: My API documentation
  version: 1.0.0
schemes:
- https
consumes:
- application/json
produces:
- application/json
host: ""

Produced output:

{
  "swagger": "2.0",
  "info": {
    "title": "My title",
    "description": "My API documentation",
    "termsOfService": "http://open-api.io/terms/",
    "contact": {
      "name": "API Support",
      "url": "http://www.open-api.io/support",
      "email": "[email protected]"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "version": "1.0.0"
  }
}

Expected output:

{
  "swagger": "2.0",
  "info": {
    "title": "My App",
    "description": "My API documentation",
    "version": "1.0.0"
  }
}

Temp fix:
I've monkey-patched RspecApiDocumentation::OpenApi::Info class and hardcoded the info json:

class RspecApiDocumentation::OpenApi::Info
  def as_json
    {
      title: "My App",
      description: "My API documentation",
      version: "1.0.0"
    }
  end
end

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