OpenAPITools / OpenAPITools/openapi-generator

[Micronaut server] Add option to restrict generation of controllers to the first tag only for a path entry.

Open
#12,224 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Leveraging release 5.4 ...

Given a yaml input document containing a snippet like the following ...

paths:
  /management/api/v1/users/{userId}:
    patch:
      x-codegen-request-body-name: message
      tags:
        - Backup Management Service
        - Backup Management Service Users
      summary: Update the specified user details
      description: Update the specified user details
      operationId: updateUserAsAdmin
      parameters:
        - name: userId
          in: path
          description: User identifier which may be extended format identifier e.g. machine:89928359235
          required: true
          schema:
            type: string
      requestBody:
        description: Details of user to update
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/rest.UserUpdateRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rest.UserResource'
        '401':
          $ref: '#/components/responses/401-Unauthorized'
        '404':
          $ref: '#/components/responses/404-NotFound'

... two controllers are generated containing the same method

BackupManagementServiceController.java
and
BackupManagementServiceUsersController.java

In our use-case, we only want a controller generated for the first tag.

The jax-rs helidon generator for example with useTags=true only leverages the first tag.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Micronaut server generator's handling of the two tags shown in the issue and compare the Helidon JAX-RS generator's useTags behavior. The work is done when an option makes the path generate only BackupManagementServiceController.java, without the duplicate BackupManagementServiceUsersController.java.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, backend, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.