You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running the generator against a sample OpenApi 3.0 spec produces invalid example code in the getting started guide. I've tried this using both the Java and JavaScript generators and the same issue exists.
openapi-generator version
4.3.1
OpenAPI declaration file content or url
openapi: "3.0.0"info:
version: 1.0.0title: Swagger Petstorelicense:
name: MITservers:
- url: http://petstore.swagger.io
- url: http://petstore-sandbox.swagger.iopaths:
/pets:
get:
summary: List all petsoperationId: listPetstags:
- petsparameters:
- name: x-api-keyin: headerdescription: API Keyschema:
type: stringexample: 5bb608a0-7711-4f0e-8b51-00cfa968e042
- name: limitin: querydescription: How many items to return at one time (max 100)required: falseschema:
type: integerformat: int32responses:
'200':
description: A paged array of petsheaders:
x-next:
description: A link to the next page of responsesschema:
type: stringcontent:
application/json:
schema:
$ref: "#/components/schemas/Pets"default:
description: unexpected errorcontent:
application/json:
schema:
$ref: "#/components/schemas/Error"components:
schemas:
Pet:
type: objectrequired:
- id
- nameproperties:
id:
type: integerformat: int64name:
type: stringtag:
type: stringPets:
type: arrayitems:
$ref: "#/components/schemas/Pet"Error:
type: objectrequired:
- code
- messageproperties:
code:
type: integerformat: int32message:
type: string
Open the README.md in the generated java directory
Look for LOC that looks like this:
String xApiKey = 5bb608a0-7711-4f0e-8b51-00cfa968e042; // String | API Key
Was expecting the value to be in quotes because the example parameter is a string type.
Related issues/PRs
Suggest a fix
It seems like the Mustache templates aren't considering the dataType of the parameter before rendering its value. Perhaps something that could be solved by adding some additional flags and inverted sections into the Mustache template or maybe using a lambda?
The text was updated successfully, but these errors were encountered:
Bug Report Checklist
Description
Running the generator against a sample OpenApi 3.0 spec produces invalid example code in the getting started guide. I've tried this using both the Java and JavaScript generators and the same issue exists.
openapi-generator version
4.3.1
OpenAPI declaration file content or url
Command line used for generation
java -jar openapi-generator-cli.jar generate
--generator-name java
--output java
--library google-api-client
--input-spec ./petstore.yaml
--group-id io.swagger.petstore.client
--artifact-id io.swagger.petstore.client
--api-package io.swagger.petstore.client.api
--model-package io.swagger.petstore.client.model
--invoker-package io.swagger.petstore.client
Steps to reproduce
java
directorystring
type.Related issues/PRs
Suggest a fix
It seems like the Mustache templates aren't considering the dataType of the parameter before rendering its value. Perhaps something that could be solved by adding some additional flags and inverted sections into the Mustache template or maybe using a lambda?
The text was updated successfully, but these errors were encountered: