Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #9630
Closed
Open
Issue created May 31, 2021 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG] warning for optional attribte spams build log with "Empty operationId found for path"

Created by: mickroll

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Generating code from specification with many operations may lead to build-log spamming with messages like:

[WARNING] Empty operationId found for path: get /{realm}/users/count. Renamed to auto-generated operationId: realmUsersCountGet
[WARNING] Empty operationId found for path: get /{realm}/users/{id}. Renamed to auto-generated operationId: realmUsersIdGet
[WARNING] Empty operationId found for path: put /{realm}/users/{id}. Renamed to auto-generated operationId: realmUsersIdPut
[WARNING] Empty operationId found for path: delete /{realm}/users/{id}. Renamed to auto-generated operationId: realmUsersIdDelete

In the case of https://github.com/ccouzens/keycloak-openapi/blob/main/keycloak/12.0-patched.json this would be 290 Warnings.

Now operationId is an optional attribte, and omitting an optional attribute should not lead to a warning in the build log, but to either silent usage of the auto-generated operationId, or an informative log-statement or one for debugging purposes. In this case, even the log-level "debug" would spam the build-log with an extreme amount of lines.

This is why I would recommend removal of the logging statement. See https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java#L4639

openapi-generator version

5.0.1

OpenAPI declaration file content or url

https://github.com/ccouzens/keycloak-openapi/blob/main/keycloak/12.0-patched.json

Generation Details
<configuration>
    <!-- only generate api operations wih given tags -->
    <apisToGenerate>Users</apisToGenerate>
    <!-- only generate models that are referenced in generated api operations -->
    <modelsToGenerate>CredentialRepresentation,FederatedIdentityRepresentation,UserConsentRepresentation,UserRepresentation,UserSessionRepresentation,GroupRepresentation</modelsToGenerate>
    <inputSpec>${project.basedir}/src/main/resources/idp/12.0-patched.json</inputSpec>
    <generatorName>jaxrs-spec</generatorName>
    <output>${project.build.directory}/generated-sources/openapi/keycloak</output>
    <configOptions>
        <useTags>true</useTags>
        <interfaceOnly>true</interfaceOnly>
        <returnResponse>false</returnResponse>
        <sourceFolder>java</sourceFolder>
        <useSwaggerAnnotations>false</useSwaggerAnnotations>
        <generatePom>false</generatePom>
        <dateLibrary>java8</dateLibrary>
    </configOptions>
</configuration>
Steps to reproduce

Generate code from https://github.com/ccouzens/keycloak-openapi/blob/main/keycloak/12.0-patched.json I suspect that any generator will lead to the same logging behaviour.

Related issues/PRs

Not for OpenAPI, but for swagger-codegen: https://github.com/swagger-api/swagger-codegen/issues/5162

Suggest a fix

Delete the mentioned log statement.

Assignee
Assign to
Time tracking