APIDevTools / swagger-cli

Swagger 2.0 and OpenAPI 3.0 command-line tool
https://apitools.dev/swagger-cli
MIT License
517 stars 68 forks source link

swagger-cli bundle -t yaml results in invalid example. #56

Open jjjasper opened 4 years ago

jjjasper commented 4 years ago

When bundling a spec that has references to examples in json files some numbers that should appear as string are written as number.

fi. the spec

                      properties:
                        branchCode:
                          maxLength: 11
                          type: string
                          description: 'Code to identify a branch, e.g. ABA or BIC'

my example json

{
   "branchCode": "0123456789"
}

the example in the bundled yaml

   brancheCode: 0123456789

Current workaround, bundle as json, convert to yaml using yamljs v0.3.0

swagger-cli bundle -t json -o openapi.json
json2yaml -s -d 99 openapi.json