* [java][jersey2-client] Disable coercion of scalars
* Respect the coercion objectmapper setting in deserializers
* Update jackson in maven plugin to get version that has ALLOW_COERCION_OF_SCALARS
* Mustache template should use invokerPackage tag to generate import
* add JsonSubTypes annotation to handle scenario when OAS name has special characters
* add JsonSubTypes annotation to handle scenario when OAS name has special characters. Add unit test
* run sample scripts
* fix unit test
* run sample scripts
* add minimal openapi document to show issue with special characters and discriminators
* Add 'isClassnameSanitized' tag
* Add 'isClassnameSanitized' tag
* Add 'isClassnameSanitized' tag
* Add 'isClassnameSanitized' tag
* Add 'isClassnameSanitized' tag
* Add 'isClassnameSanitized' tag
* Add unit tests for unmarshaling of discriminators with special characters
* Add unit tests for unmarshaling of discriminators with special characters
* use JsonTypeName
Co-authored-by: Vikrant Balyan (vvb) <vvb@cisco.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
* Support per-call authentication and JsonNullable in client request bodies
Extensions
----------
Since vertx is an asynchronous/reactive toolkit usage of mutable fields
of `ApiClient` to store authentication prohibits delegation of
authentication from incoming call without recreating the client
everytime (which is prohibitively expensive due to instantiation of objectmapper).
This commit adds a per call authentication override which takes precedence
over the mutable fields so a single client can be safely reused. To ease
usage a simple builder-style auxiliary `AuthInfo` object is provided
providing methods for each specified authentication.
A new configuration option for `ApiClient` has been added: `timeout`. It gets
applied as timeout for the vertx http request.
Fixes
-----
Request bodies have been wrongly serialized using vert.x built-in
objectmapper instead of the embedded instance thus usage of beans with
`JsonNullable` wrapped fields in request bodies led to bad requests.
* update vertx samples
* Client Java Vertx: Add url encode for path parameters.
* update vertx samples
* remove the dead code
Remove the dead code from ApiClient
The code is not used and it contains vulnerability of Log Forgery when it writes unvalidated http header to the log. An attacker could take advantage of this behaviour to forge log entries or inject malicious content into the log.
* update Petstore samples
* whitespace
* set adapterBuilder.client() only if okBuilder was used in retrofit2
* updated the samples
* added field okHttpClient and updated samples
* bug fixed, added exception if okBuilder is null
* added semicolon
* added space, changed Exception to RuntimeException and changed its message
* updated the samples
* add nullable body support
* update serializeToString with nullable body
* add nullable support to body parameter
* minor code format change
* Revert "minor code format change"
This reverts commit 3af1838a9bf421e633165dbd8e62bb7740b539ef.
* code format fix
* When withXml=false we shouldn't add the jaxb imports
When users are just dealing with json and set withXml=false jaxb (Java Api XML binding) imports are not needed.
* Updated the microprodile-rest-client samples
* Removed cxf-rt-rs-extension-providers dependency
* Fix processing of enum values
* Remove unwanted changes
* Remove spaces
* Add unit tests for additional properties
* add unit tests
* Add unit tests and fix processing of additionalProperties
* fix deserialization issue with additional properties
* Use jsonb imports for serializing and deserializing pojo
* Fix: Exclude jsonbProperty class when withXml=true
Co-authored-by: Ravisankar Challa <ravisankar.challa@qantas.com.au>
* Add jersey2-experimental to petstore build script
on-behalf-of: @nqminds <info@nquiringminds.com>
* [java] Add <source> to javadoc in pom.mustache
We add the following <source> tag to the <configuration> of
maven-javadoc-plugin for most pom.mustache files that use it.
This tells javadoc which version of java the compiler used.
This fixes the following error when running Java 11:
[ERROR] Exit code: 1 - javadoc: error - The code being documented uses
modules but the packages defined in
https://docs.oracle.com/javase/8/docs/api/ are in the unnamed module
Additionally, we also add maven-compiler-plugin to jersey2/pom.mustache
to specify that the source code is Java 6/7/8.
on-behalf-of: @nqminds <info@nquiringminds.com>
* [java-jersey2-java6] Update failing old tests
Pull-request #4666 changed jersey generation, but didn't update the
test samples Tests now succeed.
on-behalf-of: @nqminds <info@nquiringminds.com>
* [java-retrofit2-play24] Fix integration-tests
Running mvn integration-test failed in
samples/client/petstore/java/retrofit2-play24
This merges pull requests #1735 and #5527 into
retrofit2-play24.
Also removes the jackson-databind-version field,
since it should always be the same as jackson-version,
and updates build.gradle/build.sbt
on-behalf-of: @nqminds <info@nquiringminds.com>
Co-authored-by: Alois Klink <alois@nquiringminds.com>
* Mustache template should use invokerPackage tag to generate import
* fix typo, fix script issue, add log statement for troubleshooting
* Add java jersey2 samples with OpenAPI doc that has HTTP signature security scheme
* Add sample for Java jersey2 and HTTP signature scheme
* Add unit test for oneOf schema deserialization
* Add unit test for oneOf schema deserialization
* Add log statements
* Add profile for jersey2
* Temporarily disable unit test
* Temporarily disable unit test
* support for discriminator in jersey2
* fix typo in pom.xml
* disable unit test because jersey2 deserialization is broken
* disable unit test because jersey2 deserialization is broken
* fix duplicate jersey2 samples
* fix duplicate jersey2 samples
* Add code comments
* fix duplicate artifact id
* fix duplicate jersey2 samples
* run samples scripts
* resolve merge conflicts
* Add unit tests
* fix unit tests
* continue implementation of discriminator lookup
* throw deserialization exception when value is null and schema does not allow null value
* continue implementation of compose schema
* continue implementation of compose schema
* continue implementation of compose schema
* Add more unit tests
* Add unit tests for anyOf
* Add unit tests
* [java][jersey2] Add support for discriminator, fix nullable typo and nullable deserialization (#6495)
* Mustache template should use invokerPackage tag to generate import
* fix typo, fix script issue, add log statement for troubleshooting
* Add java jersey2 samples with OpenAPI doc that has HTTP signature security scheme
* Add sample for Java jersey2 and HTTP signature scheme
* Add unit test for oneOf schema deserialization
* Add unit test for oneOf schema deserialization
* Add log statements
* Add profile for jersey2
* Temporarily disable unit test
* Temporarily disable unit test
* support for discriminator in jersey2
* fix typo in pom.xml
* disable unit test because jersey2 deserialization is broken
* disable unit test because jersey2 deserialization is broken
* fix duplicate jersey2 samples
* fix duplicate jersey2 samples
* Add code comments
* fix duplicate artifact id
* fix duplicate jersey2 samples
* run samples scripts
* resolve merge conflicts
* Add unit tests
* fix unit tests
* continue implementation of discriminator lookup
* throw deserialization exception when value is null and schema does not allow null value
* continue implementation of compose schema
* continue implementation of compose schema
* continue implementation of compose schema
* Add more unit tests
* Add unit tests for anyOf
* Add unit tests
Co-authored-by: Vikrant Balyan (vvb) <vvb@cisco.com>
* update samples
* add tests to oas3 java jersey2 petstore
* Fix 'method too big' error with generated code
* resolve merge conflicts
* comment out jersey2 ensure uptodate
* fix compiler warnings
* Jersey2 supports additional properties with composed schema (#6523)
* Mustache template should use invokerPackage tag to generate import
* fix typo, fix script issue, add log statement for troubleshooting
* Add java jersey2 samples with OpenAPI doc that has HTTP signature security scheme
* Add sample for Java jersey2 and HTTP signature scheme
* Add unit test for oneOf schema deserialization
* Add unit test for oneOf schema deserialization
* Add log statements
* Add profile for jersey2
* Temporarily disable unit test
* Temporarily disable unit test
* support for discriminator in jersey2
* fix typo in pom.xml
* disable unit test because jersey2 deserialization is broken
* disable unit test because jersey2 deserialization is broken
* fix duplicate jersey2 samples
* fix duplicate jersey2 samples
* Add code comments
* fix duplicate artifact id
* fix duplicate jersey2 samples
* run samples scripts
* resolve merge conflicts
* Add unit tests
* fix unit tests
* continue implementation of discriminator lookup
* throw deserialization exception when value is null and schema does not allow null value
* continue implementation of compose schema
* continue implementation of compose schema
* continue implementation of compose schema
* Add more unit tests
* Add unit tests for anyOf
* Add unit tests
* Set supportsAdditionalPropertiesWithComposedSchema to true for Java jersey2
* Support additional properties as nested field
* Support additional properties as nested field
* add code comments
* add customer deserializer
* Fix 'method too big' error with generated code
* resolve merge conflicts
Co-authored-by: Vikrant Balyan (vvb) <vvb@cisco.com>
* [Jersey2] Fix code generation of 'registerDiscriminator' method for large models (#6535)
* Mustache template should use invokerPackage tag to generate import
* fix typo, fix script issue, add log statement for troubleshooting
* Add java jersey2 samples with OpenAPI doc that has HTTP signature security scheme
* Add sample for Java jersey2 and HTTP signature scheme
* Add unit test for oneOf schema deserialization
* Add unit test for oneOf schema deserialization
* Add log statements
* Add profile for jersey2
* Temporarily disable unit test
* Temporarily disable unit test
* support for discriminator in jersey2
* fix typo in pom.xml
* disable unit test because jersey2 deserialization is broken
* disable unit test because jersey2 deserialization is broken
* fix duplicate jersey2 samples
* fix duplicate jersey2 samples
* Add code comments
* fix duplicate artifact id
* fix duplicate jersey2 samples
* run samples scripts
* resolve merge conflicts
* Add unit tests
* fix unit tests
* continue implementation of discriminator lookup
* throw deserialization exception when value is null and schema does not allow null value
* continue implementation of compose schema
* continue implementation of compose schema
* continue implementation of compose schema
* Add more unit tests
* Add unit tests for anyOf
* Add unit tests
* Fix 'method too big' error with generated code
* resolve merge conflicts
Co-authored-by: Vikrant Balyan (vvb) <vvb@cisco.com>
* Add unit test for date time
* Add unit test for date time
* update samples
* comment out tests
* support additional properties in serialize and deserialize
* add discriminator lookup
* remove oneof/anyof logic in apilcient
* add serializer to mammal.java
* add serialize to oneOf model
* add serializer to anyof model
* comment out test cases that are subject to further discussion
* add back files
* update configs, samples
* resolve merge conflicts
Co-authored-by: Vikrant Balyan (vvb) <vvb@cisco.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
* [java][jersey2] Add support for discriminator, fix nullable typo and nullable deserialization (#6495)
* Mustache template should use invokerPackage tag to generate import
* fix typo, fix script issue, add log statement for troubleshooting
* Add java jersey2 samples with OpenAPI doc that has HTTP signature security scheme
* Add sample for Java jersey2 and HTTP signature scheme
* Add unit test for oneOf schema deserialization
* Add unit test for oneOf schema deserialization
* Add log statements
* Add profile for jersey2
* Temporarily disable unit test
* Temporarily disable unit test
* support for discriminator in jersey2
* fix typo in pom.xml
* disable unit test because jersey2 deserialization is broken
* disable unit test because jersey2 deserialization is broken
* fix duplicate jersey2 samples
* fix duplicate jersey2 samples
* Add code comments
* fix duplicate artifact id
* fix duplicate jersey2 samples
* run samples scripts
* resolve merge conflicts
* Add unit tests
* fix unit tests
* continue implementation of discriminator lookup
* throw deserialization exception when value is null and schema does not allow null value
* continue implementation of compose schema
* continue implementation of compose schema
* continue implementation of compose schema
* Add more unit tests
* Add unit tests for anyOf
* Add unit tests
Co-authored-by: Vikrant Balyan (vvb) <vvb@cisco.com>
* update samples
* add tests to oas3 java jersey2 petstore
* comment out jersey2 ensure uptodate
* Jersey2 supports additional properties with composed schema (#6523)
* Mustache template should use invokerPackage tag to generate import
* fix typo, fix script issue, add log statement for troubleshooting
* Add java jersey2 samples with OpenAPI doc that has HTTP signature security scheme
* Add sample for Java jersey2 and HTTP signature scheme
* Add unit test for oneOf schema deserialization
* Add unit test for oneOf schema deserialization
* Add log statements
* Add profile for jersey2
* Temporarily disable unit test
* Temporarily disable unit test
* support for discriminator in jersey2
* fix typo in pom.xml
* disable unit test because jersey2 deserialization is broken
* disable unit test because jersey2 deserialization is broken
* fix duplicate jersey2 samples
* fix duplicate jersey2 samples
* Add code comments
* fix duplicate artifact id
* fix duplicate jersey2 samples
* run samples scripts
* resolve merge conflicts
* Add unit tests
* fix unit tests
* continue implementation of discriminator lookup
* throw deserialization exception when value is null and schema does not allow null value
* continue implementation of compose schema
* continue implementation of compose schema
* continue implementation of compose schema
* Add more unit tests
* Add unit tests for anyOf
* Add unit tests
* Set supportsAdditionalPropertiesWithComposedSchema to true for Java jersey2
* Support additional properties as nested field
* Support additional properties as nested field
* add code comments
* add customer deserializer
* Fix 'method too big' error with generated code
* resolve merge conflicts
Co-authored-by: Vikrant Balyan (vvb) <vvb@cisco.com>
* [Jersey2] Fix code generation of 'registerDiscriminator' method for large models (#6535)
* Mustache template should use invokerPackage tag to generate import
* fix typo, fix script issue, add log statement for troubleshooting
* Add java jersey2 samples with OpenAPI doc that has HTTP signature security scheme
* Add sample for Java jersey2 and HTTP signature scheme
* Add unit test for oneOf schema deserialization
* Add unit test for oneOf schema deserialization
* Add log statements
* Add profile for jersey2
* Temporarily disable unit test
* Temporarily disable unit test
* support for discriminator in jersey2
* fix typo in pom.xml
* disable unit test because jersey2 deserialization is broken
* disable unit test because jersey2 deserialization is broken
* fix duplicate jersey2 samples
* fix duplicate jersey2 samples
* Add code comments
* fix duplicate artifact id
* fix duplicate jersey2 samples
* run samples scripts
* resolve merge conflicts
* Add unit tests
* fix unit tests
* continue implementation of discriminator lookup
* throw deserialization exception when value is null and schema does not allow null value
* continue implementation of compose schema
* continue implementation of compose schema
* continue implementation of compose schema
* Add more unit tests
* Add unit tests for anyOf
* Add unit tests
* Fix 'method too big' error with generated code
* resolve merge conflicts
Co-authored-by: Vikrant Balyan (vvb) <vvb@cisco.com>
* update samples
* comment out tests
* support additional properties in serialize and deserialize
* add discriminator lookup
* remove oneof/anyof logic in apilcient
* add serializer to mammal.java
* add serialize to oneOf model
* add serializer to anyof model
* comment out test cases that are subject to further discussion
* add back files
* update configs, samples
Co-authored-by: Sebastien Rosset <serosset@cisco.com>
Co-authored-by: Vikrant Balyan (vvb) <vvb@cisco.com>
* Ensure CLI-level generator settings are available in additional properties
* Initial conversion to yaml configs
Configs prefix with 1- need to be manually evaluated.
* Add "other" configs not in ensure-up-to-date
* Add other/openapi3 files
* Cleanup all generation scripts
* Clean up: add missed configs and fix some openapi 3 diffs
* Move generate-samples script, error on batch failures
* Temporarily disable elm which requires skip validation of spec
* CI updates (todo: run all generators through appveyor or move to github workflows)
* Add success count to batch generation command output
* [samples] Regenerate
* Remove bin/windows
* Generate swift5 samples in bitrise
* Expand user input glob pattern
* Regenerate samples
* Update PR template
* Support config based generateAliasAsModel
* [samples] Regenerate
* [rust] Generate as alias for all samples configs
* [csharp] Move test staged file changes to in-directory
* Include "live" test files and ignore test cache files from samples.ci
* Remove concept of samples.ci staging
Generators support .openapi-generator-ignore, allowing maintainers to
explicitly ignore the regeneration of files which have been modified.
Note that the tooling does not overwrite test files whenever those files
exist, and it's not entirely necessary to add test files to the ignore
file.
* Re-add meta generator scripts
* Modify ensure-up-to-date to log stdout, so script does not look like it hangs on slower machines
* [csharp] Regenerate sample
* Set generateAliasAsModel CodegenConfigurator#toContext
This ensures the property (which is effectively a thread-local) gets set
as expected if the caller resets GlobalSettings as is done in the
GenerateBatch command.
* [rust] Regenerate samples
* Re-enable elm
* [java] Support OffsetDateTime example, fail ensures script on any generation error
* [samples] Regenerate
* Fix jersey2-java8 ignore file
* Fix elm spec validation
* Force UTC in sample generation to avoid timezone conflicts during generation (user vs ci)
Co-authored-by: William Cheng <wing328hk@gmail.com>
* Mustache template should use invokerPackage tag to generate import
* fix typo, fix script issue, add log statement for troubleshooting
* Add java jersey2 samples with OpenAPI doc that has HTTP signature security scheme
* Add sample for Java jersey2 and HTTP signature scheme
* Add unit test for oneOf schema deserialization
* Add unit test for oneOf schema deserialization
* Add log statements
* Add profile for jersey2
* Temporarily disable unit test
* Temporarily disable unit test
* fix typo in pom.xml
* fix duplicate jersey2 samples
* fix duplicate jersey2 samples
* fix duplicate artifact id
* fix duplicate jersey2 samples
* run samples scripts
* [core] Refactor templating management
This refactors template management to get logic out of DefaultGenerator
and to provide a cleaner API to template search and read/compile.
Deprecates MockDefaultGenerator, which is not a mock and causes
in-memory retention of file contents. Maintainers should prefer
executing a "dryRun" with new DefaultGenerator(true) or do true
mock/spies if evaluating template intermediaries is truly necessary.
Tests may read written files with lower overhead than the in-process
retention of those bytes.
This attempts to maintain some compatibility with existing templating
adapter interfaces. Any breaking change here would be unintentional but
minimal effort to retarget the new interface.
* Tests for dry run file outputs
* Update API usage in Meta, test TemplateManager
* Wait on lastModified, lookup by filename in SpringCodegenTest
* Test DefaultGenerator + ignore file
* Move config.processOpenAPI in DefaultGenerator
* Fix wrong use of libraries templateDirector (java)
The samples scripts for Java incorrectly referenced the libraries
directories directly rather than the upper-level Java directory. This
was incorrect usage of template directories, because the generator
expects to be given the "language" directory and perform a lookup for
missing templates in the order:
* user defined libraries directory
* user defined language root
* embedded libraries directory
* embedded language root
* _common directory
This is incorrect in our samples scripts because a user or maintainer
has the expectation that any template change to files at the Java/ root
should also be honored on generation if the script specifies a custom
template directory.
* Fix handlebars extension usage, clean up Meta tasks
HandlebarseEngineAdapter previously didn't handle files without
extensions in the same was as the MustacheEngineAdapter. This now allows
for files without extension (or dotfiles) to lookup in the same
location.
Meta tasks are cleaned up to use template manager only, rather than
attempting to create an "empty" generator to use the previous templating
specific methods.
* Update kotlin-multiplatform gradle wrapper
* Rename GraphQL .gitignore template
The .gitignore file is unable to load via classpath resource from the
graphql node server resource directory (for unknown reasons). Before
this change, the missing template would fail silently.
A .gitignore file may exist in other directories and load as expected.
Added a default .gitignore to _common as a fallback so as not to break
any custom generators which may also be failing silently.
* Log entire stacktrace in go sdk built by gradle in AppVeyor
* Rename PHP .gitignore to gitignore
Java resources may not load .gitignore, this follows suit with other
generators and uses "gitignore" (some use "gitignore.mustache").
* [php] Rename .gitignore templates to gitignore
* Use same classpath lookup in common locator
* [rust] Properly escape empty triple-braces
* [samples] Regenerate
* Mustache template should use invokerPackage tag to generate import
* fix runtime exception when HttpSignatureAuth is not set
* fix runtime exception when HttpSignatureAuth is not set
* minor improvement to jersey2 test, remove script/bat
* remove tests for java7 jersey2
* remove log from abstrct java class
* undo change to jaxrs path
* generate valid code if no Authentication implementations present
resurrects https://github.com/OpenAPITools/openapi-generator/pull/2861
* remove what I assume are human generated test cases
* need to iterate over authMethods in order to pull out name
* fix another test
* update more tests
* rename hasTokenAuthMethods to hasApiKeyAuthMethods
* remove duplicate methods, fix hasHttpBearerMethods check
* update templates
* update windows java-petstore files
* update windows java-petstore files
* re-generate
* re-generate
* restore samples.ci tests
* restore samples.ci tests