You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[BUG][Default][Java][Spring][Typescript-Angular][...?] Different behavior resolving Enum schema referred from sub directories between Linux and Windows generator
#17856
Open
5 tasks done
dexterxx-pl opened this issue
Feb 13, 2024
· 2 comments
Enum schemas are generated with additional Prefix which comes from subdirectory name, if object is referred from different files.
openapi-generator version
at lest 7.0.0 - up to master from 2024-03-04 23:00 CET
OpenAPI declaration file content or url
./api.yaml
openapi: 3.0.3info:
title: Example of issue with resolving enum names between Windows and Linux generationdescription: potatoversion: 1.0.0paths:
/hello-world:
get:
summary: whateveroperationId: whateverGetresponses:
'200':
description: okcontent:
application/json:
schema:
$ref: '#/components/schemas/ResponseModel'components:
schemas:
ResponseModel:
properties:
someEnumField:
$ref: './shared/shared.yaml#/components/schemas/SomeEnum'
./schemas/some-enum.yaml
type: stringenum:
- one
- two
./shared/shared.yaml
title: shared models between apiscomponents:
schemas:
SomeEnum:
$ref: '../schemas/some-enum.yaml'
Generation Details
Issue looks global - happens on Spring Server stubs generation, Java Client, TypeScript Angular client... I've didn't tested other generators. This ticket only shows example from spring generator.
Also I've spent multiple hours to find similar issue or reason from generator codebase. My assumption and guess is that there's difference sanitizing symbol name because of different path separator in OSes.
Generator output (command below). Left Windows 10, right Debian
File difference
Yaml file regenerated from source (src/resources/openapi.yaml)
Log differences (nothing important here imho)
Issue also appears using maven plugin.
Steps to reproduce
Recreate those three yaml files like in section above
Run on Windows (command from git-bash, doesn't matter):
➜ ./jdk-21.0.2/bin/java -jar /Tools/openapi/openapi-generator-cli-7.3.0.jar generate -i api.yaml -g spring
Related issues/PRs
Didn't found.
Suggest a fix
Align behavior in Windows to Linux output.
The text was updated successfully, but these errors were encountered:
Bug Report Checklist
Description
Enum schemas are generated with additional Prefix which comes from subdirectory name, if object is referred from different files.
openapi-generator version
at lest 7.0.0 - up to
master
from 2024-03-04 23:00 CETOpenAPI declaration file content or url
./api.yaml
./schemas/some-enum.yaml
./shared/shared.yaml
Generation Details
Issue looks global - happens on Spring Server stubs generation, Java Client, TypeScript Angular client... I've didn't tested other generators. This ticket only shows example from spring generator.
Also I've spent multiple hours to find similar issue or reason from generator codebase. My assumption and guess is that there's difference sanitizing symbol name because of different path separator in OSes.
Generator output (command below). Left Windows 10, right Debian
File difference
Yaml file regenerated from source (
src/resources/openapi.yaml
)Log differences (nothing important here imho)
Issue also appears using maven plugin.
Steps to reproduce
Related issues/PRs
Didn't found.
Suggest a fix
Align behavior in Windows to Linux output.
The text was updated successfully, but these errors were encountered: