* fix: Respect `disableValidator` CLI option
Setting the `disableValidator` option to `true` used to generate
validation code but avoid calling it from the route handlers.
This generated invalid code in some cases.
This commit renders the `server-operation-validate` only, when the
`disableValidator` option is set to false (the default value).
* test: Update examples and run integration test
The generated samples are updated with:
`./bin/generate-samples.sh ./bin/configs/manual/*.yaml`
The relevant integration test
`mvn integration-test -f samples/server/petstore/rust-axum/pom.xml`
passes.
* test: Add integration test
This integration tests provokes the generation of code that would
not compile (see #18580). The new change that makes sure validation
logic is not rendered when disabled, makes sure the faulty code is not
generated and therefore the project compiles.
* test: Update examples and run integration test
The generated samples are updated with:
`./bin/generate-samples.sh ./bin/configs/manual/*.yaml`
The relevant integration test
`mvn integration-test -f samples/server/petstore/rust-axum/pom.xml`
passes.
* fix: Fix uuid in header params causing errors
Routes with header parameters with a `format` of `uuid` in the openAPI
specification used to cause a compilation error in the resulting
Rust Axum code.
This commit fixes the issue by including the correct conversion trait
implementation on the condition that at least one header parameter of
`format` `uuid` is included in the specification.
* refactor: Add final to boolean
* fix: Bring str::FromStr optionally into scope
The trait needs to be in scope for the TryFrom implementation:
`TryFrom<HeaderValue> for IntoHeaderValue<uuid::Uuid> `
It will only be brought into scope when the implementation is rendered.
* test: Add integration test and its specification
This commit adds an integration test that tests the bug fix for #18554.
A header parameter of `format: uuid` is included in one route.
This makes the example create a route handler that tries to extract a
Rust `uuid::Uuid` type from the header. The integration test will check
that the generated code compiles.
* test: Update examples and run integration test
The generated samples are updated with:
`./bin/generate-samples.sh ./bin/configs/manual/*.yaml`
Most example projects have their version numbers bumped. Some changes
show, that there are some other unrelated changes to the files, which
indicates that some prior commit did not update the samples accordingly.
The relevant integration test
`mvn integration-test -f samples/server/petstore/rust-axum/pom.xml`
passes.
When components/schema/<object> reference other objects, validate() was
getting called on the referenced objects with no arguments. The return
value was void, but checked as if it was a boolean value.
* [Java/Microprofile] Add support for Jackson serialization & async interfaces using Mutiny in Java Microprofile library
* Regenerate samples & docs
* Add server generator
* Update client to set configKey by classname
* Remove debug remains and comments
* Adapt method override to upstream changes
* Regenerate samples
* Revert "Regenerate samples"
This reverts commit b5bcbdea90c71a2819a3ea6339c3878f249f97b4.
* Move additional 2xx response to dedicated OpenAPI document
Some other generators than those for Micronaut don't seem to be able to
handle this case, so we don't add it to the general pet store document.
* Make filename consistent with other files in the folder
* Regenerate Microprofile client and server samples
* Generate samples
* Update documentation
* Generate samples
* Remove left-over `*.orig` files from Git merges
* Regenerate samples
* Regenerated samples
* changed generator name to "java-microprofile"
* added the new folder to .github/workflows/samples-java-server-jdk8.yaml so that CI will test it moving forward
* Renamed JavaMicroprofileServerCodegen.java
* regenerated samples
* only enable configKeyFromClassName if configKey is not set
* Updated documentation
* Change samples to use junit 4
* Fix junit 4 test classes
* run ensure up-to-date script
* fix kotlin test errors
---------
Co-authored-by: pravussum <pravussum@users.noreply.github.com>
Co-authored-by: frank <frank.buechel@kiwigrid.com>
Co-authored-by: Oscar <oscar.obrien@kiwigrid.com>
Co-authored-by: oscarobr <133783370+oscarobr@users.noreply.github.com>
* [kotlin] Target correct library in jvm-spring-webclient sample
* [kotlin] Fixed warning in jvm-spring-restclient
* [kotlin-client] Bump Gradle version
* [kotlin-client] enableFeaturePreview no longer needed as it's enabled by default
* [kotlin-client] Bump kotlin, spotless, and reactor versions
* [kotlin-client] Generated code
* [kotlin-client] Missed a generated sample
* [kotlin-client] Bumped gradle and java version in kotlin-client workflows
* [kotlin-client] First attempt to fix jvm-volley
* [kotlin-client] Use standard gradle action instead of custom one
* [kotlin-client] Use original gradlew action but without specific version
* [kotlin-client] Moved sample kotlin-spring-cloud to servers instead of clients
* [kotlin-client] Added previously missing generated file
* [kotlin-client] Corrected sample path
* [BUG] [C++][Pistache] cpp-pistache-server generating API include undefined "Object.h" (#2769)
Should handle Object.h, AnyType.h correctly. Set.h also tested.
- #include Object.h removed and replaced by a typeMapping.put(object, nlohmann::json) like suggested in other issues
- object had an invalid syntax: ':' instead of '::' in types with namespace
- extra include of #include nlohmann/json.h removed when there's already #include <nlohmann/json.hpp>
- nlohmann::json is excluded from model namespace
Tested with custom petstore played, with suggested openapi specs coming from issues #2769, #10266, #14234
```bash
rm -rf samples/server/petstore/cpp-pistache-everything/ && ./bin/generate-samples.sh ./bin/configs/cpp-pistache-server-cpp-pistache-everything.yaml && cd samples/server/petstore/cpp-pistache-everything/ && mkdir build && cd build && cmake .. && cmake --build . --parallel
```
* - Adding to samples/server/petstore cpp-pistache-everything
* - .md and FILES missing
* feat (JAVA SPRING RESTTEMPLATE) 17571: initial commit for Spring RestClient
* feat (JAVA SPRING RESTTEMPLATE) 17571: Copied and changed the webclient mustache files
The RestClient API is oriented on the WebClient API so many parts of the templates can be the same
* fix (JAVA SPRING RESTTEMPLATE) 17571: Renaming error & add README template
The README must be changed because the minimal Java Version for this client is 17
* fix (JAVA SPRING RESTTEMPLATE) 17571: Imports, compile errors and cookie setting
* feat (JAVA SPRING RESTTEMPLATE) 17571: Add generated samples
* test (JAVA SPRING RESTTEMPLATE) 17571: Add tests
* feat (JAVA SPRING RESTTEMPLATE) 17571: Update doc
* Add the restcilent to samples-java-client-jdk17.yam
The minimum Java version of the used Spring Version is 17
* fix (JAVA SPRING RESTTEMPLATE) 17571: Workflow paths to petstore samples
* fix (JAVA SPRING RESTTEMPLATE) 17571: Regenerated samples
* feat (JAVA SPRING RESTTEMPLATE) 17571: Generated echo-api sample for RestClient
* fix (JAVA SPRING RESTTEMPLATE) 17571: Missing import
* fix (JAVA SPRING RESTTEMPLATE) 17571: Missing body class exception when null body is set
* test (JAVA SPRING RESTTEMPLATE) 17571: Add echo-api Auth test
* fix (JAVA SPRING RESTTEMPLATE) 17571: Gradlew file permissions
* feat (JAVA SPRING RESTTEMPLATE) 17571: Reggenerate samples after rebase
* test (JAVA SPRING RESTTEMPLATE) 17571: Add echo-api Body gif test
* test (JAVA SPRING RESTTEMPLATE) 17571: Add echo-api octet stream body test
* test (JAVA SPRING RESTTEMPLATE) 17571: Add echo-api multipart form data test
* fix (JAVA SPRING RESTTEMPLATE) 17571: Form as body when body is null
Also regenerated the restclient samples
* Update php.md - marked Multiserver as true
Mulitiserver support was fully implemented 2 years ago, on PR #12982
* update php feature
* update
---------
Co-authored-by: Thomas Hansen <thomasphansen@users.noreply.github.com>
* fix imports with go generation
* Wrong copy over
* Missing new line
* tab vs space
* Fix new line between router and std go libs
* Add both use case, add samples to CI validation
* Update samples
* fixOpenAPITools/openapi-generator#18060
* isolate the option as separate flag
* apply modification suggested by @wing328
* remove added newlines
* do not change the handle of multipart body, keep the change only for x-www-form-urlencoded
* renamed OpenAPIClient-httpclient to Petstore
* updated bin artifacts
* renamed OpenAPIClientCoreAndNet47 to MultipleFrameworks
* updated bin artifacts
* renamed OpenAPIClient-net47 to Petstore
* renamed OpenAPIClient-net48 to Petstore
* updated bin artifacts
* renamed OpenAPIClient-restsharp-name-parameter-mappings to ParameterMappings
* updated bin artifacts
* renamed OpenAPIClientCore to Petstore
* updated bin artifacts
* renamed OpenAPIClient-net7.0-useDateTimeForDate to UseDateTimeForDate
* updated bin artifacts
* renamed OpenAPIClient-net5.0 to EnumMappings
* updated bin artifacts
* renamed OpenAPIClient-ConditionalSerialization to ConditionalSerialization
* updated bin artifacts
* renamed OpenAPIClient to Petstore
* updated bin artifacts
* renamed OpenAPIClient-unityWebRequest to Petstore
* updated bin artifacts
* updated appveyor
* updated bin artifacts
* updated bin artifacts
* comenting out a sample project with no csproj file
* updated bin artifacts
* Add java-jersey2 sample with mixed oneOf
* [java][jersey2]Fix client generation if oneOf contains an array type
Changes:
* Change jersey2/oneof_model template to use composed schema data
* Change adding of imports in AbstractJavaCodegen to use composed schema data
* Add escapedDataType property to CodegenProperty so that the data type
may be part of identifiers (e.g. in getters)
* Update samples
* Add sample for multiple array in oneOf
* Fix generation of constructors with same erasures
* Update samples again
* Version bump
* Add new sample folders to CI
* Make primitive handling more explicit
* Replace escapedDataType property with Mustache lambda
* Update samples with new primitive handling and sanitization lambda
* moved OpenAPIClient-generichost-net6.0
* moved OpenAPIClient-generichost-netcore-latest-allOf
* moved OpenAPIClient-generichost-netcore-latest-anyOf
* moved OpenAPIClient-generichost-netcore-latest-oneOf
* moved OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration
* moved OpenAPIClient-generichost-net6.0-nrt
* moved OpenAPIClient-generichost-net7.0-useDateTimeForDate
* moved OpenAPIClient-generichost-manual-tests
* moved OpenAPIClient-generichost-netstandard2.0
* moved OpenAPIClient-generichost-net6.0
* deleted abandoned files
* updated bin artifacts
* build samples
* updated workflow
* fix manual tests
* moved manual tests
* moved allOf
* moved anyOf
* moved oneOf
* moved OpenAPIClient-generichost-net6.0
* moved OpenAPIClient-generichost-net6.0-nrt
* moved OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration
* moved OpenAPIClient-generichost-net7.0-useDateTimeForDate
* moved OpenAPIClient-generichost-netstandard2.0
* moved OpenAPIClient
* moved OpenAPIClient-ConditionalSerialization
* moved OpenAPIClient-httpclient
* moved OpenAPIClient-net5.0
* moved OpenAPIClient-net7.0-useDateTimeForDate
* moved OpenAPIClient-net47
* moved OpenAPIClient-net48
* moved OpenAPIClient-restsharp-name-parameter-mappings
* moved OpenAPIClient-unityWebRequest
* moved OpenAPIClientCore
* moved OpenAPIClientCoreAndNet47
* renamed standard2 to standard2.0
* renamed standard2 to standard2.0
* fixed workflows
* renamed workflows
* updated bin artifacts
* updated bin artifacts
* pinned the samples to their version
* renamed bin artifacts
* update bin artifact
* update bin artifact
* update bin artifact
* updated appveyor
* reverting changes bc git does not show the rename
* commiting all but the file rename for these two files
* Skip post processing when generating JAXRS spec with Kotlin
This feature was previously added to work with the javalin5 library
* Add sample that proves what we expect after fixing this
* Update sample
* Added new samples to samples workflow
* Revert from jdk17 pipeline
* fix: jersey3 library
fix issue that library failed in case pattern matching was used in
the api.
* add tests, update version
* update
* fix tag
* fix, update samples
* update build
* more update
* update workflow
* test useJakarta
---------
Co-authored-by: holomekc <30546982+holomekc@users.noreply.github.com>
* Add notes to requests for better readability
* Adds extra configs for jetbrains http client for testing
* Adding new sample data
* Changes
* Setting up test infrastructure
* Adds body to requests.
* Fixing some bugs in map traversal
It'd be much better to use a proper library for this though
* Adding secret file to gitignore
* Adds github spec, for complex example.
Add null check to avoid errors in example extraction
* Add support for custom variables in request body
* Add support for all basic Auth headers
* Not sure whaet happened with my api mustache file
* Add support for custom headers
* Fixes empty lines issue
* Adds support for Accept header
* Adding many tests, deleting experiment files
* Updates generator doc
* Completes README file with extra information
* Runs generate-samples and export docs
* Running sample generation
* Adding missing files to samples
* Removing forgotten stdout statements
* Ignore one test making the docker image generation fail
* add initial openapi config and java generated files
* add java implementation for adding generator version
* regenerate sample client files
* remove tabs
* only show generated version if build info exists
* set build info for batch generation
* update generator doc for new global flag
* use existing property for generator version
* update templates to include generator version
* update templates for better generator version syntax
* revert undesired changes
* regenerate samples for openapi client
* update templates to correct formatting/newlines
* correct description text and add to usage doc
* add generator cli option for all codegen types
* use more concise version info; update existing codegens to support new prop
* correct wrong prop reference
* add initial test coverage for new prop
* update last (scala) templates with new prop
* update samples after upstream merge
* use consistent version output
* use better sample project id/name
* revert using option for generator version in templates
* + Cookie parameter generation fixed
* Added cookie parameter mustache template for generating cookie related code
* Adapted kotlin-spring api templates to include cookie parameters
* Added tests for evaluating cookie parameter code generation
* Added configuration sample for the new cookie use case
* - Unused fake cases removed
* Removed fake cases from openapi spec that were not related to cookie usage
* Cleaned sample files
* Update csharp oneOf and anyOf mustache templates to accept primitive, object, and array types when deserializing
Add bug openapi spec
Remove generated files
Add test endpoints
Generate base on spec
Remove issue spec as it is moved into sample test spec
Add back in number and int
Round trip anyOf/oneOf serialization tests
Generate classes with int/num types
Do through converter instead of object ctor
Regen models
Use convert methods
Regen models
Test data
Add enum
Remove enums
Regenned models
* update sha256
* use new spec
* skip tests
* update workflow
* fix
---------
Co-authored-by: Ruben Aguilar <ruben.aguilar@forgeglobal.com>
* feat(client): support ability to disable boxed models
Add new additional property `avoidBoxedModels` which can be configured to avoid `Box<..>` of models.
It's very nice to have such config, because it doesn't make a lot of sense for really simple models.
* test: rollback config of existed test
* Fixed invalid extraction of response body in kotlin-client jvm-spring-*
* Generated echo-api for kotlin-jvm-spring-3-restclient
* Specific echo-api for Kotlin without allOf/anyOf
* Specific echo-api for Kotlin without allOf/anyOf
* Generated all samples
* Added kotlin-jvm-spring-3-restclient sample to workflow
* Fixed syntax problem
* [kotlin] Fixed multiple problems with default values
* [kotlin] Removed old commented code
* [kotlin] Generated new samples after merge with master
* [kotlin] ensure-up-to-date
* fix(rust): discriminator mapping to serde rename
Discriminator mapping has been ignored in some cases.
Even existing samples had wrong definition in some cases
This PR addresses this
* fix(rust): `oneOf` generation for client
Solves #17869 and #17896 and also includes unmerged $17898
Unfortunately it affects quite a lot of code, but we can see that only client-side models were affected by re-generation.
I tried to split this PR to several, but they're really coupled and hard to create a chain of PRs.
* fix: indentation in `impl Default`
* missing fixes
* fix: correct typeDeclaration with unaliased schema
* style: improve indentation for models
* fix: user toModelName for aliases of oneOf
* refactor: unify `getTypeDeclaration` for rust
* cover the case when `mapping` has the same `ref` for different mapping names
* test: add test for previous change
* style: remove extra qualified path to models
* add some comments
* fix(build): use method of `List` instead of specific for `LinkedList`
* add feature to generate only interface files
* generate sample
* add workflow file foe go gin service
* add workflow file foe go gin service
* add workflow file foe go gin service
* update samples