* 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
* Update Dockerfile.mustache
Using alpine instead of ubuntu for leaner Docker images.
Small fix for welcome message.
Changing default shell to `zsh` and fixing entrypoint.
* update samples
* move config, add new files
Co-authored-by: avbenavides <62693723+avbenavides@users.noreply.github.com>
* Bash: Update samples
I'm about to make a fix to the bash generator. I'm regenerating the
samples in this commit so that the change I make isn't lost amongst
the noise.
https://github.com/OpenAPITools/openapi-generator/pull/3290
* Bash client: Fix query params seperation
Fix bug where empty query parameters weren't separated by ampersands.
For example, this
```bash
bash bash_keycloak/client.sh -v --oauth2-bearer "$access_token" --host "$api_host" realmUsersGet realm=demo_realm2 email=foo+bar@baz.com
```
would generate the path
`/auth/admin/realms/demo_realm2/users?briefRepresentation=email=foo+bar@baz.comfirst=firstName=lastName=max=search=username=`.
It now puts ampersands around them to make
`/auth/admin/realms/demo_realm2/users?briefRepresentation=&email=foo+bar@baz.com&first=&firstName=&lastName=&max=&search=&username=`
Instead of predicting if there is going to be a `parameter_value` ahead of
time, we now put in the ampersand if there is a `parameter_value` and existing
`query_request_part`.
https://github.com/OpenAPITools/openapi-generator/pull/3290
* Bash: Skip query parameters with empty value
I have a route with many optional query parameters.
I observed that when they weren't specified, they were still included in
the routes, but without a value.
Running:
```bash
bash bash_keycloak/client.sh -v --header "Authorization: Bearer $access_token" --host "$api_host" --dry-run realmUsersGet realm=demo_realm2 email=foo+bar@baz.com username=foo
```
Would produce the route:
`http://localhost:8080/auth/admin/realms/demo_realm2/users?briefRepresentation=&email=foo+bar@baz.com&first=&firstName=&lastName=&max=search=&username=foo`
After this change it produces the route:
``http://localhost:8080/auth/admin/realms/demo_realm2/users?email=foo+bar@baz.com&username=foo
---
I discussed with @wing328 in the pull request about if empty values (eg
`username=` should produce an empty query parameter, or if the query
parameter should be removed.
We decided it should remove the query parameter.
https://github.com/OpenAPITools/openapi-generator/pull/3290
----
The OpenAPI definition I was using:
Using:
https://github.com/ccouzens/keycloak-openapi/blob/master/keycloak/6.0.json
In particular:
```json
"/{realm}/users": {
"get": {
"summary": "Get users Returns a list of users, filtered according to query parameters",
"parameters": [
{
"in": "query",
"name": "briefRepresentation",
"schema": {
"type": "boolean"
},
"style": "form"
},
{
"in": "query",
"name": "email",
"schema": {
"type": "string"
},
"style": "form"
},
{
"in": "query",
"name": "first",
"schema": {
"type": "integer",
"format": "int32"
},
"style": "form"
},
{
"in": "query",
"name": "firstName",
"schema": {
"type": "string"
},
"style": "form"
},
{
"in": "query",
"name": "lastName",
"schema": {
"type": "string"
},
"style": "form"
},
{
"in": "query",
"name": "max",
"description": "Maximum results size (defaults to 100)",
"schema": {
"type": "integer",
"format": "int32"
},
"style": "form"
},
{
"in": "query",
"name": "search",
"description": "A String contained in username, first or last name, or email",
"schema": {
"type": "string"
},
"style": "form"
},
{
"in": "query",
"name": "username",
"schema": {
"type": "string"
},
"style": "form"
}
],
```
The only special handling was for security definition type `apiKey`
in `query`. All the other security configurations should result in the
same generated code.
Moves the handling of the special query parameters outside of the
`parameters without specific cardinality` section.
To cover the scenario where `elif` was being used, simply leverage the
builtin `continue` statement to stop processing the specific query
parameter and continue to the next available query parameter, if any.
Manually test with multiple different combinations.
Resolves: #6526
When a spec defines a Model at the top level that is a non-aggretate type (such
as string, number or boolean), it essentially represents an alias for the simple
type. For example, the following spec snippet creates an alias of the boolean
type that for all intents and purposes acts just like a regular boolean.
definitions:
JustABoolean:
type: boolean
This can be modeled in some languages through built-in mechanisms, such as
typedefs in C++. Java, however, just not have a clean way of representing this.
This change introduces an internal mechanism for representing aliases. It
maintains a map in DefaultCodegen that tracks these types of definitions, and
wherever it sees the "JustABoolean" type in the spec, it generates code that
uses the built-in "Boolean" instead.
This functionality currenlty only applies to Java, but could be extended to
other languages later.
The change adds a few examples of this to the fake endpoint spec for testing,
which means all of the samples change as well.
* Removed trailing spaces
* Fixed autocomplete support for bash-completion < 1.4
* Added mime type autocomplete for Zsh
* Fixed Bash url autocompletion
* Fixed Zsh space after operation arguments and added trim to descriptions
* Added generation of Dockerfile for packaging Bash rest clients
* updated test samples for Bash client generator