swagger-api / swagger-api/swagger-codegen
Vars that should be required according to the swagger - are generated as not required.
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Vars that should be required according to the swagger - are generated as not required.
I see that it happens only to vars that are type "object".
Swagger-codegen version
2.2.2-SNAPSHOT
Swagger declaration file content or url
"create_ref": {
"allOf": [
{
"$ref": "#/definitions/json_api_version"
},
{
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"type": "object",
"required": [
"type",
"id",
"meta"
],
"properties": {
"type": {
"type": "string",
"enum": [
"folders",
"items",
"versions"
]
},
"id": {
"type": "string"
},
"meta": {
"type": "object",
"required": [
"extension"
],
"properties": {
"extension": {
"$ref": "#/definitions/base_attributes_extension_object"
}
}
}
}
}
}
}
]
}
Command line used for generation
using java
Steps to reproduce
generate java sdk
Suggest a Fix
You can see in the json that under data there is array of requited vars:
"required": [
"type",
"id",
"meta"
]
but since "meta" is defined as object (I think that is the issue) it is not return in the "getRequired()" method in ModelImpl class.
(The same happens with it's parent "data")
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 ModelImpl.getRequired() and reproduce the Java SDK generation using the supplied Swagger declaration and command. Trace how required arrays are handled for the object-valued data and meta properties; done means required object variables are included in the generated model metadata as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100