swagger-api / swagger-api/swagger-codegen
[JavaScript] Missing `ModelObject` in JS
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When using a oneof with openapi: "3.0.0" the code generates an import inside the models folder for ./ModelObject. models/ModelObject.js is never generated.
Swagger-codegen version
3.0.18
Swagger declaration file content or url
MyObject:
title: MyObjectTitle
type: object
properties:
messageType:
type: string
message:
oneOf:
- $ref: '#/components/schemas/MessageA'
- $ref: '#/components/schemas/MessageB'
required:
- messageType
Command line used for generation
On OSX (installed via brew):
swagger-codegen generate --lang javascript --input my-spec.yml -o ./
Steps to reproduce
Create above model in a yaml file, run generation command, attempt to build project.
Related issues/PRs
N/A
Suggest a fix/enhancement
If we know what the outputted code should be I can shim this into our library to unblock us.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied OpenAPI 3.0.0 YAML and run the shown JavaScript generation command. Inspect the generated models directory and the import of ./ModelObject; done means the generated project builds without a missing ModelObject.js file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100