26 Commits

Author SHA1 Message Date
William Cheng
741bf0c035
Prepare 7.7.0-SNAPSHOT (#18709)
* Revert "7.6.0 release"

This reverts commit d76f9d32d11a03be2b40ebff728ef0ff86332fcb.

* prepare 7.7.0 snapshot in master

* update samples
2024-05-20 17:27:17 +08:00
William Cheng
807250a430
Prepare 7.6.0 (#18412)
* Revert "v7.5.0 release"

This reverts commit 1eafe2aebf33b13bee0ead66d62a6436e7db059d.

* update master to v7.6.0 snapshot

* update readme

* update samples
2024-04-17 19:05:37 +08:00
William Cheng
4ff7e0ec3f
Prepare 7.5.0 snapshot (#18068)
* Revert "7.4.0 release"

This reverts commit eda049348425171df772a7b9087cc97db718cfda.

* prepare 7.5.0 snapshot version

* update samples

* update doc
2024-03-11 11:10:52 +08:00
Ross Bender
cf2435f335
Add support for controlling output of OpenAPI Generator version in generated files (#17952)
* 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
2024-03-09 15:52:08 +08:00
William Cheng
b1564d8002
Fix UUID default value cast exception (swift5) (#16436) 2023-08-29 12:32:01 +01:00
William Cheng
946d145d30
[bash] Update Bash Client Dockerfile.mustache (#9310)
* 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>
2021-04-22 15:02:38 +08:00
William Cheng
5c275bccd2
Throw exception when config file missing (#4557)
* throw exception when config file missing

* fix bash config location
2019-11-22 14:01:57 +08:00
William Cheng
d5b09cff2a
[Bash] Minor improvements (#4274)
* minor improvements to bash generator

* test bash

* fix path

* test bash in travis

* fix pom
2019-10-26 11:30:08 +08:00
Chris Couzens
6358b11516 Bash skip empty query param fix (#3290)
* 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"
            }
          ],
```
2019-07-27 21:48:36 +08:00
Jérémie Bresson
059a3efe46 Regenerate samples (#367) 2018-05-08 16:44:51 +08:00
William Cheng
4845eaa81d
Update bash Petstore OAS2 (#112)
* update bash petstore oas2, fix default parameter, map file to binary

* update bash petstore with oas3 script
2018-04-17 22:39:26 +08:00
Bartek Kryza
8b61b1d466 #7047 - Added Bash syntax check to tests (#7155) 2017-12-13 11:14:07 +08:00
Kenny Jones
4b0314498b Bugfix: Handle all different types of security (#6528)
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
2017-09-24 23:07:12 +08:00
Pavel Tavoda
d412bcfd6c Fix to #6141 - [BASH] Bug generating access_token when "in: query" (#6187)
* Fix to #6141 - [BASH] Bug generating access_token when "in: query"

* Fresh petstore scripts
2017-07-28 16:00:44 +08:00
wing328
e1e5ac4d37 Merge remote-tracking branch 'origin/master' into 2.3.0 2017-05-17 22:00:06 +08:00
Benjamin Douglas
9058099e5b Add alias type definitions for Java
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.
2017-04-17 12:58:31 -07:00
wing328
cf8a9a0de0 Merge remote-tracking branch 'origin/master' into 2.3.0 2017-04-03 14:54:50 +08:00
Paŭlo Ebermann
ce41a343d8 Updating all samples (except feign) (#5281) 2017-04-02 17:01:15 +08:00
wing328
20cc80d170 Merge remote-tracking branch 'origin/master' into 2.3.0 2017-03-26 23:05:46 +08:00
Paŭlo Ebermann
c812d81e9a Issue #3084: remove timestamps from bash samples. (#5192) 2017-03-26 22:56:34 +08:00
Paul Ebermann
5bb0f7a933 Update all samples. 2017-03-15 18:25:40 +01:00
Paŭlo Ebermann
9be178b26a Merge branch 'master' into new-sync-master-to-2.3.0 2017-03-13 21:42:41 +01:00
Paŭlo Ebermann
3a48ba8bfd Update all the samples.
(except clojure + scalatra, because those are broken, will fixed with later master merge.)
2017-03-13 19:50:10 +01:00
Bartek Kryza
1b1767e489 [Bash] Bugfix default curl options fix (#4832)
* Fixed default cURL parameter handling

* Fixed iterator increments in JSON body Bash generator

* Added tests for content type and default cURL params

* Fixed generated Dockerfile Bash script access rights

* Generated test sample client

* Updated Bash generator README
2017-03-02 17:48:30 +08:00
Bartek Kryza
73395bce44 [Bash] Bash generator improvements (#4730)
* 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
2017-02-07 23:15:05 +08:00
Bartek Kryza
0fb154e9a2 [Bash] Bash client script generator (#4541)
* Initial commit

* Remormatted petstore tests

* Added Bash codegen to main README.md

* Added bash to integration tests

* Fixed stdin detection in generated script

* Added back ruby module
2017-01-12 16:48:25 +08:00