OpenAPITools / OpenAPITools/openapi-generator

[BUG][spring] -Dapis requires title-cased tags, even when tags are lowercase

Open
#5,591 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug Server: Spring
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

This may be related only to Spring generator.

If a user has a tag defined as devices, the user will have to request -Dapis=Devices (or <apis>Devices</apis> in Maven). This isn't intuitive.

This was found by a user in Slack. I repro'd with:

<configuration>
    <inputSpec>lukas.yml</inputSpec>
    <generatorName>spring</generatorName>
    <configOptions>
        <sourceFolder>/</sourceFolder>
        <modelPackage>org.openapi.tools.model</modelPackage>
        <apiPackage>org.openapi.tools.api</apiPackage>
        <interfaceOnly>true</interfaceOnly>
        <java8>true</java8>
        <dateLibrary>java8</dateLibrary>
        <booleanGetterPrefix>is</booleanGetterPrefix>
        <useTags>true</useTags>
    </configOptions>
    <environmentVariables>
        <apis>Devices</apis>
    </environmentVariables>
</configuration>
openapi-generator version

4.3.0-SNAPSHOT (as of today) and below

OpenAPI declaration file content or url
openapi: 3.0.2
info:
  title: "Java template service"
  description: "Example of java microservice API defined with OpenApi v3"
  version: 1.0.0
tags:
  - name: devices
    description: Box devices
paths:
  '/api/devices':
    get:
      tags:
        - devices
      operationId: "getDevices"
      summary: List of devcies
      description: Devices
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Device"

components:
  schemas:
    Device:
      required:
        - "id"
        - "mac"
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
          example: "EF41860F-68AD-4ABE-8D6F-3734EDDE3017"
        mac:
          type: string
          format: mac_address
          readOnly: true
          example: "112233445566"
        online:
          type: boolean
          readOnly: true
          default: false
          example: false
        
Command line used for generation
Steps to reproduce

Copied above maven config into maven example java-client.xml and ran.

Related issues/PRs
Suggest a fix

Support both title and lower cases.

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 Maven example configuration in java-client.xml and reproduce the Spring generator run using the provided OpenAPI document and apis setting. Trace how the Spring generator matches the lowercase devices tag, then verify that both lowercase and title-cased values select the same API output.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.