Skip to content

[SPRING] Create constants for paths  #1385

@adrianiacobghiula

Description

@adrianiacobghiula
Description

It would be better to generate constants for the paths (in an apiRoute interface)
String FIND_PET_BY_STATUS_URL = "/pet/findByStatus";

@RequestMapping(value = PetApiRoute.FIND_PET_BY_STATUS_URL,

This could be helpful : for testing using mockMvc to to add the constant. for adding the URL in the spring security antMatchers or anywhere you need the actual URL

Suggest a fix/enhancement

Adding a apiRoute.mustache
{{#operations}} public interface {{classname}}Route { {{#operation}} String {{operationIdSnakeCase.toUpperCase}}_URL = "{{{path}}}"; {{/operation}} } {{/operations}}

And
@RequestMapping(value = {{classname}}Route.{{operationIdSnakeCase.toUpperCase}}_URL,

might be enough

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions