swagger-api / swagger-api/swagger-codegen-generators
Java Micronaut codegen: how to incorporate OpenAPI v3.x relative URLs for endpoint path generation?
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 299
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
Consider an OpenAPI yaml spec file with this definition:
openapi: "3.0.2"
info:
title: Some title
description: Some description
version: 0.0.1
contact:
name: Some name
url: http://www.example.com
email: support@example.com
servers:
- url: /v1/
paths:
/users:
get:
operationId: getUsers
I've also tried setting basePath instead:
openapi: "3.0.2"
info:
title: Some title
description: Some description
version: 0.0.1
contact:
name: Some name
url: http://www.example.com
email: support@example.com
servers:
- url: http://localhost:8080
basePath: /v1
paths:
/users:
get:
operationId: getUsers
I would have expected that the endpoint path generated is /v1/users, but instead it's just /users.
Is there a way to incorporate this path into my endpoints? Either by subclassing MicronautCodegen, or maybe by editing my mustache templates?
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 by reading the referenced MicronautCodegen.java implementation and the Java mustache templates to trace how endpoint paths are assembled. Use the sample OpenAPI specification with servers.url or basePath as the reproduction case, then verify that generated endpoints include /v1 before /users.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100