[JavaJaxRS] Vendor Extensions Not Accessed in model.mustache
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia con i template jaxrs-cxf, in particolare licenseInfo.mustache, model.mustache e pojo.mustache, e confronta il loro contesto di rendering con api.mustache e apiServiceImpl.mustache. Riproduci il problema usando lo YAML OpenAPI fornito e swagger-codegen-cli-3.0.24. Il lavoro è completato quando x-year viene renderizzato dal template licenseInfo incluso nei file model e POJO generati, come avviene nei file API.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
When I update the licenseInfo.mustache template to reference vendor extensions and nest it in other templates, it works fine in files such as api.mustache, api_test.mustache, and apiServiceImpl.mustache. It does not output the value in model.mustache or pojo.mustache. Referencing included template variables (such as infoName) works fine.
Swagger-codegen version
swagger-codegen-cli-3.0.24 (cannot use latest at the moment due to Java version)
Swagger declaration file content or url
Unfortunately I cannot paste all of the code in here, but I can at least show how things are referenced/declared:
Folder structure:
swagger
/gen
/codegen
swagger-codegen-cli-3.0.24.jar
/templates
/jaxrs-cxf
<contents of JavaJaxRS folder from JAR file>
/output
/api
openapi: 3.0.1
x-year: 2025
info:
name: Your Name
paths:
Declaration in licenseInfo.mustache:
{{vendorExtensions.x-year}}
Use of licenseInfo.mustache in model.mustache and api.mustache
{{>licenseInfo}}
config-api.json
{
"hideGenerationTimestamp": true,
"java8": true,
"dateLibrary": "java8",
"useSwaggerFeature": true,
"modelPackage": "some.package.name",
"apiPackage": "some.package.name",
"invokerPackage": "some.package.name",
"useOas2": false,
"ignoreImportMappings": false,
"importMappings": {
"Set": "java.util.Set"
},
"addConsumesProducesJson": true
}
Command line used for generation
java -jar ./gen/codegen/swagger-codegen-cli-3.0.24.jar generate -D useGenericResponse=true -i swagger.yaml -t gen/templates/jaxrs-cxf -l jaxrs-cxf -o output/api -c config-api.json
Steps to reproduce
- Setup directory as shown above.
- Using any yaml file with a defined model, add the x-year property at the root level. Also, to show that included variables work fine, ensure to include info -> name in the yaml.
- Update the licenseInfo template directly under jaxrs-cxf folder to the above reference, using the template variable (name) and the vendor extension (x-year).
- Import licenseInfo to model.mustache and api.mustache per the above reference.
- cd into the swagger folder and run the JAR from there.
- When you open the API file(s), you will see that the licenseInfo text is there, with the year and name.
- When you open the model file, you will notice that the licenseInfo text is there, with the name, but minus the year. So, I think the import is working, but perhaps there's a vendor extension scoping issue somewhere?
Related issues/PRs
I didn't find anything similar.
Suggest a fix/enhancement
Fix the issue.
- Lingua principale
- Mustache
- Stelle
- 17.8k
- Fork
- 6k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di swagger-api/swagger-codegen
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
swagger-api/swagger-codegen#12755 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
swagger-api/swagger-codegen#12445 ·
-
security vulnerability
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
swagger-api/swagger-codegen#11942 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
swagger-api/swagger-codegen#11812 · 1 reazione ·
-
security vulnerability
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
swagger-api/swagger-codegen#11594 ·
Tutte le issue di swagger-api/swagger-codegen
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
external-issue to-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
googleapis/google-cloud-swift#1151 ·
-
SqliteSaver.list(filter=...) silently misses nested metadata values containing non-ASCII text Apertaexternal
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
langchain-ai/langgraph#9074 · 1 commento ·
-
documentation specification
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
openai/openai-openapi#584 ·