swagger-api / swagger-api/swagger-codegen
[Python] external schemas each containing '#/parameter'
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I am combining several OpenAPI specifications, each of which has several external references. The generator reaches
all external references but mixes up one #/parameters in an external schema with one in a different external schema.
Swagger-codegen version
3.0.25
Swagger declaration file content or url
OpenApi 3 spec is a mashup of several, but the only two needed to reproduce the problem are:
- https://developers.exlibrisgroup.com/wp-content/uploads/alma/openapi/conf.json
- https://developers.exlibrisgroup.com/wp-content/uploads/alma/openapi/users.json
I will upload the combined spec once this issue is created, but see also https://github.com/NLM-OCCS/python-alma-sdk
Command line used for generation
java -jar lib/swagger-codegen-cli.jar generate -l python -c api-config.json -i target/spec.json --resolve-fully -o target
api-config.json has these contents:
{
"packageName": "alma_api",
"modelPackage": "models",
"apiPackage": "apis"
}
Steps to reproduce
- Create an environment with apache ant in the path
- Clone from https://github.com/NLM-OCCS/python-alma-sdk
- Bootstrap apache ivy by entering "ant bootstrap"
- Build the spec and package by entering "ant build"
In the generated code, you can easily see the problem as follows:
grep Almawsv1confjobsjobIdParameter target/alma_api/models/*.py
For instance, the following should each be referencing Almawsv1usersParameter:
target/alma_api/models/user_role.py: 'parameter': 'list[Almawsv1confjobsjobIdParameter]'
target/alma_api/models/user_role.py: :rtype: list[Almawsv1confjobsjobIdParameter]
target/alma_api/models/user_role.py: :type: list[Almawsv1confjobsjobIdParameter]
Related issues/PRs
There is an salesforce issue reported to the vendor Ex Libris that I will separately update, and close.
Suggest a fix/enhancement
Unsure of the fix.
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
Clone NLM-OCCS/python-alma-sdk, bootstrap Ivy with ant bootstrap, then run ant build using the linked OpenAPI specifications and api-config.json. Inspect target/alma_api/models/user_role.py and the grep result for Almawsv1confjobsjobIdParameter; done means references from the users schema resolve to Almawsv1usersParameter rather than the conf schema parameter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, python
- Domain
- backend-api-design, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100