-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Fix a few issues with the C generator (part 2) #20227
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b1228c5
[C] Don't convert post body strings to JSON
eafer 2188741
[C] Implement BearerToken authentication
eafer d713cad
[C] Handle nullable fields correctly
eafer de108c7
[C] Fix implementation of FromString for enums
eafer 279e3f7
[C] Update the test schemas to cover the changes
eafer f22dab8
Update samples
eafer b9abe77
Fix the updated samples
eafer c36bd1d
[C] Add the new samples folder to the CI workflow
eafer 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 hidden or 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 hidden or 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,4 @@ | ||
| generatorName: c | ||
| outputDir: samples/client/others/c/bearerAuth | ||
| inputSpec: modules/openapi-generator/src/test/resources/3_0/c/bearer_auth.yaml | ||
| templateDir: modules/openapi-generator/src/main/resources/C-libcurl | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
58 changes: 58 additions & 0 deletions
58
modules/openapi-generator/src/test/resources/3_0/c/bearer_auth.yaml
This file contains hidden or 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,58 @@ | ||
| # Copied from k6 | ||
| openapi: 3.0.0 | ||
| info: | ||
| title: Sample API | ||
| description: Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML. | ||
| version: 0.1.9 | ||
| servers: | ||
| - url: http://api.example.com/v1 | ||
| description: Optional server description, e.g. Main (production) server | ||
| - url: http://staging-api.example.com | ||
| description: Optional server description, e.g. Internal staging server for testing | ||
| security: | ||
| - bearerAuth: [] | ||
| paths: | ||
| /users: | ||
| get: | ||
| summary: Returns a list of users. | ||
| description: Optional extended description in CommonMark or HTML. | ||
| responses: | ||
| "200": # status code | ||
| description: A JSON array of user names | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: array | ||
| items: | ||
| type: string | ||
| security: | ||
| - bearerAuth: [] | ||
| /public: | ||
| get: | ||
| summary: Returns public information. | ||
| description: This endpoint does not require authentication. | ||
| responses: | ||
| "200": | ||
| description: A JSON object with public information | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| security: [] | ||
| /private: | ||
| get: | ||
| summary: Returns private information. | ||
| description: This endpoint requires global security settings. | ||
| responses: | ||
| "200": | ||
| description: A JSON object with private information | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| components: | ||
| securitySchemes: | ||
| bearerAuth: | ||
| type: http | ||
| scheme: bearer | ||
| bearerFormat: JWT # Optional: specify the format (e.g., JWT) if applicable |
23 changes: 23 additions & 0 deletions
23
samples/client/others/c/bearerAuth/.openapi-generator-ignore
This file contains hidden or 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,23 @@ | ||
| # OpenAPI Generator Ignore | ||
| # Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
|
||
| # Use this file to prevent files from being overwritten by the generator. | ||
| # The patterns follow closely to .gitignore or .dockerignore. | ||
|
|
||
| # As an example, the C# client generator defines ApiClient.cs. | ||
| # You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
| #ApiClient.cs | ||
|
|
||
| # You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
| #foo/*/qux | ||
| # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
|
||
| # You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
| #foo/**/qux | ||
| # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
|
||
| # You can also negate patterns with an exclamation (!). | ||
| # For example, you can ignore all files in a docs folder with the file extension .md: | ||
| #docs/*.md | ||
| # Then explicitly reverse the ignore rule for a single file: | ||
| #!docs/README.md |
22 changes: 22 additions & 0 deletions
22
samples/client/others/c/bearerAuth/.openapi-generator/FILES
This file contains hidden or 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,22 @@ | ||
| CMakeLists.txt | ||
| Packing.cmake | ||
| README.md | ||
| api/DefaultAPI.c | ||
| api/DefaultAPI.h | ||
| docs/DefaultAPI.md | ||
| external/cJSON.c | ||
| external/cJSON.h | ||
| external/cJSON.licence | ||
| include/apiClient.h | ||
| include/binary.h | ||
| include/keyValuePair.h | ||
| include/list.h | ||
| libcurl.licence | ||
| model/any_type.h | ||
| model/object.c | ||
| model/object.h | ||
| src/apiClient.c | ||
| src/apiKey.c | ||
| src/binary.c | ||
| src/list.c | ||
| uncrustify-rules.cfg |
This file contains hidden or 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 @@ | ||
| 7.11.0-SNAPSHOT |
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.
Uh oh!
There was an error while loading. Please reload this page.