-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[windows] Fixed missing output #19715
Merged
wing328
merged 10 commits into
OpenAPITools:master
from
devhl-labs:19708-windows-missing-generated-output
Oct 7, 2024
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
806da65
fixed missing output
devhl-labs 63b77d6
bug fix
devhl-labs 5b658d5
merge master
devhl-labs b0cb8f3
add new sample
devhl-labs 8eedcdd
merge master
devhl-labs 7f09d25
build samples again
devhl-labs c2e3253
delete sample
devhl-labs dc56b82
move the sample and add to github workflow
devhl-labs 829aebe
remove model not needed for this test
devhl-labs 2e578bf
handle specs with no models
devhl-labs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# for csharp generichost | ||
generatorName: csharp | ||
outputDir: samples/client/petstore/csharp/generichost/latest/Tags | ||
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/tags.json | ||
library: generichost | ||
templateDir: modules/openapi-generator/src/main/resources/csharp | ||
additionalProperties: | ||
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' | ||
modelPropertySorting: alphabetical | ||
operationParameterSorting: alphabetical |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
modules/openapi-generator/src/test/resources/3_0/csharp/tags.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ | ||
"info": { | ||
"title": "Files.com API", | ||
"contact": { | ||
"name": "Files.com Customer Success Team", | ||
"email": "[email protected]" | ||
}, | ||
"version": "0.0.1" | ||
}, | ||
"swagger": "2.0", | ||
"produces": [ | ||
"application/json", | ||
"application/msgpack", | ||
"application/xml" | ||
], | ||
"securityDefinitions": { | ||
"api_key": { | ||
"type": "apiKey", | ||
"description": "API Key - supports user-based or site-wide API keys", | ||
"name": "XFilesAPIKey", | ||
"in": "header" | ||
} | ||
}, | ||
"host": "app.files.com", | ||
"basePath": "/api/rest/v1", | ||
"tags": [ | ||
{ | ||
"name": "api_key", | ||
"description": "Operations about api_keys" | ||
}, | ||
{ | ||
"name": "API Keys", | ||
"description": "Operations about API Keys" | ||
}, | ||
{ | ||
"name": "a_p_i_k_e_y_s", | ||
"description": "Operations about API keys" | ||
} | ||
], | ||
"paths": { | ||
"/api_keys/{id}": { | ||
"get": { | ||
"summary": "Show API Key", | ||
"description": "Show API Key", | ||
"produces": [ | ||
"application/json" | ||
], | ||
"parameters": [ | ||
{ | ||
"in": "path", | ||
"name": "id", | ||
"description": "Api Key ID.", | ||
"type": "integer", | ||
"format": "int32", | ||
"required": true, | ||
"x-ms-summary": "Api Key ID." | ||
} | ||
], | ||
"responses": { | ||
"400": { | ||
"description": "Bad Request", | ||
"x-ms-summary": "Bad Request" | ||
} | ||
}, | ||
"tags": [ | ||
"api_keys", | ||
"API Keys", | ||
"a_p_i_k_e_y_s" | ||
devhl-labs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
], | ||
"operationId": "GetApiKeysId", | ||
"x-authentication": [ | ||
"self_managed" | ||
], | ||
"x-category": [ | ||
"developers" | ||
] | ||
} | ||
} | ||
} | ||
, | ||
"definitions": {} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this breaks the use case in which more than one operation having the same name (e.g. getId) and now users will get something different
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can revert it but we will need a sample for the use case this breaks and another pr with this fix that doesn't break that sample.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you say users get something different, is it wrong, or just different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's nice addition to prevent spec with duplicated operationId generating code that won't compile. Thanks again for the PR.
Let me think about how to deal with auto fix (opt in or out) and come up with a solution.
Will definitely add samples/tests for to cover this case moving forward.
Thanks again for your work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please refer to the discussion in https://openapi-generator.slack.com/archives/CLSB0U0R5/p1728581031429579?thread_ts=1728372817.754659&cid=CLSB0U0R5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please take your time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have multiple endpoints in my openapi.json which have the same operationId. This was perfectly fine in 7.8.0 and is also fine "in real life" because they are all below different path. I have for example two GET endpoints
With the JavaSpring generator, I now get interfaces generated with "getAvailableMonth_0" inside the
ReportControllerApi
and one "getAvailableMonth" inMonthlySettlementControllerApi
.This is just an example - I have multiple endpoints with "create", "delete" and so on operationIds - they now all end up getting generated as create_0 up to create_4 - all in different Controllers.... this really looks like a mess to be honest.
How can I revert back to the old behaviour. There is no point to make this methods unique project-wide when they end up getting generated in different Controller Interfaces (not generating a client, using tags to group endpoints controller-wise). Additionally those numbers don't seem to be predictable so it just ends up with not usable method names (because they may vary in the future I guess). At least tags should be considered to verify if random numbers have to be added or not. It makes no sense to add them for same operationIds in different tags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clearly the _0 is a breaking change. The issue for me is that I use the operationId in the name of a class which means it has to be unique. I thought using the operationId would give me a unique value, but that is not true when there are tags. I'll have to explore a different way to handle this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On class level you are right (have to be unique). If I understood the initial problem correctly, it was all about Windows filesystem limitations (case insensitive). So maybe the file names have to be unique case-insensitiive wise, but the code inside the files might not. I mean while Windows can't have File1.x and file1.x in parallel, it might have File1.x and file1_0.x but with classes File1 and file1 inside. But - not sure if there are languages out which dictate classname must be equal filename.
And one problem remains imho. The names become inpredictable. What guarantees that "...._0" will be "..._0" in the future and not silently will be generated as "..._2" at one point instead. Maybe just because some dev decides to reorder the openapi spec? Adding iterating numbers seems not right at all imho but maybe I'm missing something 😄
What about taking the tag into consideration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _0 part of this pr reverted in a new pr. Thanks for being understanding. #19913