java – Generate URL constants in openapi generator

I’ve read some excerpts from the documentation of the openapi generator but haven’t been able to find something about URL constants. Can it generate String constants for each endpoint?

For example I have country.yml with the contents below:

openapi: 3.0.3

info:
  title: service, country
  description: service REST interface
  version: '1.0.0'

tags:
  - name: country
    description: Country operations

paths:
  /country:
    get:
      description: Get countries
      tags:
        - country
      operationId: getCountries
...

As can be seen it contains the endpoint “/country”

Would it be possible to configure the generator so that it creates the corresponding String constant in the API interface?

For example:

@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "...")
@Tag(name = "country", description = "Country operations")
public interface CountryApi {

String COUNTRY = "/country"
...

Read more here: Source link