OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.82k stars 6.58k forks source link

[BUG][All generators] Specification extension for info object is not exposed #4211

Open ghost opened 5 years ago

ghost commented 5 years ago

Bug Report Checklist

Description

According to the documentation the info object can be extended with Specification Extensions / Vendor extensions. However it does not work and generators does not expose that information to the templates.

It works for example in OpenApi object and Opeartion object but not in Info object

openapi-generator version

4.2.0-SNAPSHOT

OpenAPI declaration file content or url
openapi: 3.0.1
info:
  title: Info service
  x-api-prefix: UFO
  version: 1.1.0
servers:
  - url: http://localhost:8080/v1
    description: PROD
paths:
  /info:
    get:
      summary: Get some info
      operationId: getInfo
      responses:
        200:
          description: OK

and mustach template (api.mustache): {{this}}

Command line used for generation
java -jar ../../openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i openapi/info-service-v1.yaml -o serviceAPIs/Info -t ./openapi/template/

(build from master branch)

Same result with different generator:

npx openapi-generator generate -g typescript-axios -i openapi/info-service-v1.yaml -o serviceAPIs/Info -t ./openapi/template
Steps to reproduce

Just try to generate code, for Java generator look into file: serviceAPIs/Notification/src/main/java/org/openapitools/client/api/DefaultApi.java and try to find UFO

For npm look of UFO in api.ts file

Related issues/PRs
Suggest a fix

Fix should expose extensions to the mustache templates

auto-labeler[bot] commented 5 years ago

👍 Thanks for opening this issue! 🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.