From 524626f5e914bfef6025d0e1c2cbc7a728d08f56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mladen=20Jablanovi=C4=87?= Date: Mon, 30 Oct 2023 15:55:49 +0100 Subject: [PATCH] feat: Update openapi-generator to v7 (#418) --- Makefile | 2 +- doc/compiled.json | 2 +- main.yaml | 6 +- openapi-generator/cli_lang.yaml | 1 + openapi-generator/go_lang.yaml | 1 + .../templates/cli/api.handlebars | 4 +- openapi-generator/templates/cli/api_test.hbs | 0 openapi-generator/templates/cli/client.hbs | 0 .../templates/cli/configuration.hbs | 0 openapi-generator/templates/cli/response.hbs | 0 openapi-generator/templates/cli/utils.hbs | 0 .../templates/go/README.mustache | 21 +- openapi-generator/templates/go/api.mustache | 11 +- .../templates/go/api_doc.mustache | 8 +- .../templates/java/README.mustache | 6 +- openapi-generator/templates/java/api.mustache | 8 +- .../templates/java/api_doc.mustache | 8 +- .../templates/java/api_test.mustache | 2 +- .../java/jackson_annotations.mustache | 2 +- .../java/libraries/feign/ApiClient.mustache | 2 +- .../java/libraries/feign/api.mustache | 14 +- .../java/libraries/feign/api_test.mustache | 4 +- .../libraries/google-api-client/api.mustache | 14 +- .../google-api-client/api_test.mustache | 2 +- .../jersey2-experimental/api.mustache | 20 +- .../jersey2-experimental/api_doc.mustache | 12 +- .../jersey2-experimental/api_test.mustache | 4 +- .../jersey2-experimental/pojo.mustache | 20 +- .../java/libraries/jersey2/api.mustache | 20 +- .../java/libraries/jersey2/api_doc.mustache | 12 +- .../java/libraries/jersey2/api_test.mustache | 4 +- .../java/libraries/microprofile/api.mustache | 6 +- .../libraries/microprofile/api_test.mustache | 10 +- .../java/libraries/microprofile/pojo.mustache | 18 +- .../java/libraries/native/api.mustache | 6 +- .../java/libraries/okhttp-gson/api.mustache | 26 +- .../libraries/okhttp-gson/api_doc.mustache | 10 +- .../libraries/okhttp-gson/api_test.mustache | 2 +- .../java/libraries/rest-assured/api.mustache | 2 +- .../libraries/rest-assured/api_doc.mustache | 6 +- .../java/libraries/resteasy/api.mustache | 8 +- .../java/libraries/resttemplate/api.mustache | 30 +- .../libraries/resttemplate/api_test.mustache | 2 +- .../libraries/retrofit/ApiClient.mustache | 2 +- .../java/libraries/retrofit/api.mustache | 4 +- .../java/libraries/retrofit/api_test.mustache | 2 +- .../libraries/retrofit2/ApiClient.mustache | 2 +- .../java/libraries/retrofit2/api.mustache | 4 +- .../libraries/retrofit2/api_test.mustache | 2 +- .../libraries/retrofit2/play24/api.mustache | 4 +- .../libraries/retrofit2/play25/api.mustache | 4 +- .../libraries/retrofit2/play26/api.mustache | 4 +- .../java/libraries/vertx/apiImpl.mustache | 6 +- .../java/libraries/vertx/rxApiImpl.mustache | 2 +- .../java/libraries/webclient/api.mustache | 16 +- .../libraries/webclient/api_test.mustache | 2 +- .../templates/java/model.mustache | 3 +- .../templates/java/pojo.mustache | 420 ++++++++++++++---- .../templates/php/ObjectSerializer.mustache | 6 +- .../templates/php/README.mustache | 23 +- openapi-generator/templates/php/api.mustache | 24 +- .../templates/php/api_doc.mustache | 8 +- .../templates/php/model_generic.mustache | 20 +- .../templates/python/api.mustache | 24 +- .../templates/python/api_client.mustache | 10 +- .../templates/python/api_doc.mustache | 6 +- .../templates/python/api_doc_example.mustache | 2 +- .../templates/python/common_README.mustache | 23 +- .../templates/python/model.mustache | 12 +- .../templates/python/model_test.mustache | 2 +- .../README_common.mustache | 6 +- .../python/python-experimental/api.mustache | 10 +- .../python-experimental/api_doc.mustache | 6 +- .../api_doc_example.mustache | 12 +- .../python/python-experimental/setup.mustache | 4 +- .../templates/python/setup.mustache | 4 +- .../templates/ruby-client/README.mustache | 17 +- .../templates/ruby-client/api.mustache | 6 +- .../templates/ruby-client/api_doc.mustache | 8 +- .../ruby-client/base_object.mustache | 4 +- .../partial_model_generic.mustache | 16 +- .../typescript-fetch/README.mustache | 21 +- .../templates/typescript-fetch/apis.mustache | 58 +-- .../typescript-fetch/modelGeneric.mustache | 32 +- openapitools.json | 2 +- 85 files changed, 755 insertions(+), 424 deletions(-) create mode 100644 openapi-generator/templates/cli/api_test.hbs create mode 100644 openapi-generator/templates/cli/client.hbs create mode 100644 openapi-generator/templates/cli/configuration.hbs create mode 100644 openapi-generator/templates/cli/response.hbs create mode 100644 openapi-generator/templates/cli/utils.hbs diff --git a/Makefile b/Makefile index 13ab16d6..f5576ea2 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ docs: lint bundle ruby: openapi-generator-cli generate -i tmp/compiled.yaml -g ruby -o clients/ruby -c ./openapi-generator/ruby_lang.yaml go: - openapi-generator-cli generate -i tmp/compiled.yaml -g go -o clients/go -c ./openapi-generator/go_lang.yaml + openapi-generator-cli generate -i tmp/compiled.yaml -g go -o clients/go -c ./openapi-generator/go_lang.yaml --global-property apiTests=false,modelTests=false go install golang.org/x/tools/cmd/goimports@latest goimports -w clients/go cd clients/go && go mod tidy diff --git a/doc/compiled.json b/doc/compiled.json index f1202337..7464b507 100644 --- a/doc/compiled.json +++ b/doc/compiled.json @@ -3,7 +3,7 @@ "info": { "title": "Phrase Strings API Reference", "version": "2.0.0", - "description": "Phrase Strings is a translation management platform for software projects. You can collaborate on language file translation with your team or order translations through our platform. The API allows you to import locale files, download locale files, tag keys or interact in other ways with the localization data stored in Phrase Strings for your account.\n\n## API Endpoints\n\n### EU data center\n```\nhttps://api.phrase.com/v2/\n```\n\n### US data center\n\n```\nhttps://api.us.app.phrase.com/v2\n```\n\nThe API is only accessible via HTTPS and the current version is v2, which results in a base URL like: https://api.phrase.com/v2/ depending on the datacenter.\n\n\n## Usage\n\n[curl](http://curl.haxx.se/) is used primarily to send requests to Phrase Strings in the examples. On most you'll find a second variant using the [Phrase Strings API v2 client](https://phrase.com/cli/) that might be more convenient to handle. For further information check its [documentation](https://support.phrase.com/hc/en-us/articles/5808300599068).\n\n## Use of HTTP Verbs\n\nPhrase Strings API v2 tries to use the appropriate HTTP verb for accessing each endpoint according to REST specification where possible:\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
VerbDescription
GETRetrieve one or multiple resources
POSTCreate a resource
PUTUpdate a resource
PATCHUpdate a resource (partially)
DELETEDelete a resource
\n
\n\n\n## Identification via User-Agent\n\nYou must include the User-Agent header with the name of your application or project. It might be a good idea to include some sort of contact information as well, so that we can get in touch if necessary (e.g. to warn you about Rate-Limiting or badly formed requests). Examples of excellent User-Agent headers:\n\n```\nUser-Agent: Example Mobile App (example@phrase.com)\nUser-Agent: ACME Inc Python Client (http://example.com/contact)\n```\n\nIf you don't send this header, you will receive a response with 400 Bad Request.\n\n\n## Lists\n\nWhen you request a list of resources, the API will typically only return an array of resources including their most important attributes. For a detailed representation of the resource you should request its detailed representation.\n\nLists are usually [paginated](#pagination).\n\n\n## Parameters\n\nMany endpoints support additional parameters, e.g. for pagination. When passing them in a GET request you can send them as HTTP query string parameters:\n\n```\n$ curl -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects?page=2\"\n```\n\nWhen performing a POST, PUT, PATCH or DELETE request, we recommend sending parameters that are not already included in the URL, as JSON body:\n\n```\n$ curl -H 'Content-Type: application/json' -d '{\"name\":\"My new project\"}' -u EMAIL_OR_ACCESS_TOKEN https://api.phrase.com/v2/projects\n```\n\nEncoding parameters as JSON means better support for types (boolean, integer) and usually better readability. Don't forget to set the correct Content-Type for your request.\n\n*The Content-Type header is omitted in some of the following examples for better readbility.*\n\n\n## Errors\n\n\n### Request Errors\n\nIf a request contains invalid JSON or is missing a required parameter (besides resource attributes), the status `400 Bad Request` is returned:\n\n```\n{\n \"message\": \"JSON could not be parsed\"\n}\n```\n\n\n### Validation Errors\n\nWhen the validation for a resource fails, the status `422 Unprocessable Entity` is returned, along with information on the affected fields:\n\n```\n{\n \"message\": \"Validation Failed\",\n \"errors\": [\n {\n \"resource\": \"Project\",\n \"field\": \"name\",\n \"message\": \"can't be blank\"\n }\n ]\n}\n```\n\n\n## Date Format\n\nTimes and dates are returned and expected in [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601) date format:\n\n```\nYYYY-MM-DDTHH:MM:SSZ\n```\n\nInstead of 'Z' for UTC time zone you can specify your time zone's locale offset using the following notation:\n\n```\nYYYY-MM-DDTHH:MM:SS±hh:mm\n```\n\nExample for CET (1 hour behind UTC):\n\n```\n2015-03-31T13:00+01:00\n```\n\nPlease note that in HTTP headers, we will use the appropriate recommended date formats instead of ISO 8601.\n\n\n## Authentication\n\nThere are two different ways to authenticate when performing API requests:\n\n* E-Mail and password\n* Oauth Access Token\n\n\n### E-Mail and password\n\nTo get started easily, you can use HTTP Basic authentication with your email and password:\n\n```\n$ curl -u username:password \"https://api.phrase.com/v2/projects\"\n```\n\n\n### OAuth via Access Tokens\n\nYou can create and manage access tokens in your [profile settings](https://app.phrase.com/settings/oauth_access_tokens) in Translation Center or via the [Authorizations API](#tag--Authorizations).\n\nSimply pass the access token as the username of your request:\n\n```\n$ curl -u ACCESS_TOKEN: \"https://api.phrase.com/v2/projects\"\n```\n\nor send the access token via the `Authorization` header field:\n\n```\n$ curl -H \"Authorization: token ACCESS_TOKEN\" https://api.phrase.com/v2/projects\n```\n\n#### Send via parameter\n\nAs JSONP (and other) requests cannot send HTTP Basic Auth credentials, a special query parameter `access_token` can be used:\n\n```\ncurl \"https://api.phrase.com/v2/projects?access_token=ACCESS_TOKEN\"\n```\n\nYou should only use this transport method if sending the authentication via header or Basic authentication is not possible.\n\n### Two-Factor-Authentication\n\nUsers with Two-Factor-Authentication enabled have to send a valid token along their request with certain authentication methods (such as Basic authentication). The necessity of a Two-Factor-Authentication token is indicated by the `X-PhraseApp-OTP: required; :MFA-type` header in the response. The `:MFA-type`field indicates the source of the token, e.g. `app` (refers to your Authenticator application):\n\n```\nX-PhraseApp-OTP: required; app\n```\n\nTo provide a Two-Factor-Authentication token you can simply send it in the header of the request:\n\n```\ncurl -H \"X-PhraseApp-OTP: MFA-TOKEN\" -u EMAIL https://api.phrase.com/v2/projects\n```\n\nSince Two-Factor-Authentication tokens usually expire quickly, we recommend using an alternative authentication method such as OAuth access tokens.\n\n### Multiple Accounts\n\nSome endpoints require the account ID to be specified if the authenticated user is a member of multiple accounts. You can find the eight-digit account ID inside Translation Center by switching to the desired account and then visiting the account details page. If required, you can specify the account just like a normal parameter within the request.\n\n## Pagination\n\nEndpoints that return a list or resources will usually return paginated results and include 25 items by default. To access further pages, use the `page` parameter:\n\n```\n$ curl -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects?page=2\"\n```\n\nSome endpoints also allow a custom page size by using the `per_page` parameter:\n\n```\n$ curl -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects?page=2&per_page=50\"\n```\n\nUnless specified otherwise in the description of the respective endpoint, `per_page` allows you to specify a page size up to 100 items.\n\n\n## Link-Headers\n\nWe provide you with pagination URLs in the [Link Header field](http://tools.ietf.org/html/rfc5988). Make use of this information to avoid building pagination URLs yourself.\n\n```\nLink: ; rel=\"first\", ; rel=\"prev\", ; rel=\"next\", ; rel=\"last\"\n```\n\nPossible `rel` values are:\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
ValueDescription
nextURL of the next page of results
lastURL of the last page of results
firstURL of the first page of results
prevURL of the previous page of results
\n
\n\n## Rate Limiting\n\nAll API endpoints are subject to rate limiting to ensure good performance for all customers. The rate limit is calculated per user:\n\n* 1000 requests per 5 minutes\n* 4 concurrent (parallel) requests\n\nFor your convenience we send information on the current rate limit within the response headers:\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
HeaderDescription
X-Rate-Limit-LimitNumber of max requests allowed in the current time period
X-Rate-Limit-RemainingNumber of remaining requests in the current time period
X-Rate-Limit-ResetTimestamp of end of current time period as UNIX timestamp
\n
\n\nIf you should run into the rate limit, you will receive the HTTP status code `429: Too many requests`.\n\nIf you should need higher rate limits, [contact us](https://phrase.com/contact).\n\n\n## Conditional GET requests / HTTP Caching\n\n

Note: Conditional GET requests are currently only supported for locales#download and translations#index

\n\nWe will return an ETag or Last-Modified header with most GET requests. When you request a resource we recommend to store this value and submit them on subsequent requests as `If-Modified-Since` and `If-None-Match` headers. If the resource has not changed in the meantime, we will return the status `304 Not Modified` instead of rendering and returning the resource again. In most cases this is less time-consuming and makes your application/integration faster.\n\nPlease note that all conditional requests that return a response with status 304 don't count against your rate limits.\n\n```\n$ curl -i -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects/1234abcd1234abcdefefabcd1234efab/locales/en/download\"\nHTTP/1.1 200 OK\nETag: \"abcd1234abcdefefabcd1234efab1234\"\nLast-Modified: Wed, 28 Jan 2015 15:31:30 UTC\nStatus: 200 OK\n\n$ curl -i -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects/1234abcd1234abcdefefabcd1234efab/locales/en/download\" -H 'If-None-Match: \"abcd1234abcdefefabcd1234efab1234\"'\nHTTP/1.1 304 Not Modified\nETag: \"abcd1234abcdefefabcd1234efab1234\"\nLast-Modified: Wed, 28 Jan 2015 15:31:30 UTC\nStatus: 304 Not Modified\n\n$ curl -i -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects/1234abcd1234abcdefefabcd1234efab/locales/en/download\" -H \"If-Modified-Since: Wed, 28 Jan 2015 15:31:30 UTC\"\nHTTP/1.1 304 Not Modified\nLast-Modified: Wed, 28 Jan 2015 15:31:30 UTC\nStatus: 304 Not Modified\n```\n\n\n## JSONP\n\nThe Phrase Strings API supports [JSONP](http://en.wikipedia.org/wiki/JSONP) for all GET requests in order to deal with cross-domain request issues. Just send a `?callback` parameter along with the request to specify the Javascript function name to be called with the response content:\n\n```\n$ curl \"https://api.phrase.com/v2/projects?callback=myFunction\"\n```\n\nThe response will include the normal output for that endpoint, along with a `meta` section including header data:\n\n```\nmyFunction({\n {\n \"meta\": {\n \"status\": 200,\n ...\n },\n \"data\": [\n {\n \"id\": \"1234abcd1234abc1234abcd1234abc\"\n ...\n }\n ]\n }\n});\n```\n\nTo authenticate a JSONP request, you can send a valid [access token](#overview--oauth-via-access-tokens) as the `?access_token` parameter along the request:\n\n```\n$ curl \"https://api.phrase.com/v2/projects?callback=myFunction&access_token=ACCESS-TOKEN\"\n```\n\n
\n\n
\n\n
\n\n## Usage examples\n\nLearn how to work more efficiently with Phrase Strings API v2 with these\nworkflow-oriented examples.\n\n
\n\n
\n\n
\n\n
\n\n### Find excluded translations with a certain content\n\n GET /v2/projects/:project_id/translations\n\nList excluded translations for the given project which start with the\nterm `PhraseApp`.\n\n#### Parameters\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
NameTypeDescription
sort
\noptional
stringSort criteria. Can be one of: key_name, created_at, updated_at.
\nDefault: key_name
order
\noptional
stringOrder direction. Can be one of: asc, desc.
\nDefault: asc
q
\noptional
stringSpecify a query to find translations by content (including wildcards).
\nNote: Search is limited to 10000 results and may not include recently updated data (depending on the project size).\n
\nThe following qualifiers are supported in the query:
\n\n
    \n
  • id:translation_id,... for queries on a comma-separated list of ids
  • \n
  • tags:XYZ for tags on the translation
  • \n
  • unverified:{true|false} for verification status
  • \n
  • reviewed:{true|false} for reviewed status
  • \n
  • excluded:{true|false} for exclusion status
  • \n
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • \n
\nFind more examples here.
\n\n
\n\n
\n\n
\n\n#### Example Request\n\n
\n\n``` language-bash\ncurl \"https://api.phrase.com/v2/projects/:project_id/translations?sort=updated_at&order=desc&q=PhraseApp*%20excluded:true\" \\\n -u USERNAME_OR_ACCESS_TOKEN\n```\n\n
\n\n
\n\n``` language-bash\nphrase translations list \\\n--project_id \\\n--sort updated_at \\\n--order desc \\\n--query 'PhraseApp* excluded:true' \\\n--access_token \n```\n\n
\n\n\n
\n\n
\n\n
\n\n
\n\n### Find unverified translations with a certain content\n\n GET /v2/projects/:project_id/translations\n\nList unverified translations for the given project which start with the\nterm `PhraseApp` and are not verified.\n\n#### Parameters\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
NameTypeDescription
sort
\noptional
stringSort criteria. Can be one of: key_name, created_at, updated_at.
\nDefault: key_name
order
\noptional
stringOrder direction. Can be one of: asc, desc.
\nDefault: asc
q
\noptional
stringSpecify a query to find translations by content (including wildcards).
\n
Note: Search is limited to 10000 results and may not include recently updated data (depending on the project size).\n
\nThe following qualifiers are supported in the query:
\n\n
    \n
  • id:translation_id,... for queries on a comma-separated list of ids
  • \n
  • tags:XYZ for tags on the translation
  • \n
  • unverified:{true|false} for verification status
  • \n
  • reviewed:{true|false} for reviewed status
  • \n
  • excluded:{true|false} for exclusion status
  • \n
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • \n
\nFind more examples here.
\n\n
\n\n
\n\n
\n\n#### Example Request\n\n
\n\n``` language-bash\ncurl \"https://api.phrase.com/v2/projects/:project_id/translations?sort=updated_at&order=desc&q=PhraseApp*%20unverified:true\" \\\n -u USERNAME_OR_ACCESS_TOKEN\n```\n\n
\n\n
\n\n``` language-bash\nphrase translations list \\\n--project_id \\\n--sort updated_at \\\n--order desc \\\n--query 'PhraseApp* unverified:true' \\\n--access_token \n```\n\n
\n\n
\n\n
\n\n
\n\n
\n\n### Verify translations selected by query\n\n PATCH /v2/projects/:project_id/translations/verify\n\nVerify all translations that are matching the query `my dog`.\n\n#### Parameters\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
NameTypeDescription
q
\noptional
stringSpecify a query to find translations by content (including wildcards).
\n
Note: Search is limited to 10000 results and may not include recently updated data (depending on the project size).\n
\nThe following qualifiers are supported in the query:
\n\n
    \n
  • id:translation_id,... for queries on a comma-separated list of ids
  • \n
  • tags:XYZ for tags on the translation
  • \n
  • unverified:{true|false} for verification status
  • \n
  • reviewed:{true|false} for reviewed status
  • \n
  • excluded:{true|false} for exclusion status
  • \n
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • \n
\nFind more examples here.
sort
\noptional
stringSort criteria. Can be one of: key_name, created_at, updated_at.
\nDefault: key_name
order
\noptional
stringOrder direction. Can be one of: asc, desc.
\nDefault: asc
\n\n
\n\n
\n\n
\n\n#### Example Request\n\n
\n\n``` language-bash\ncurl \"https://api.phrase.com/v2/projects/:project_id/translations/verify\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X PATCH \\\n -d '{\"q\":\"my dog unverified:true\",\"sort\":\"updated_at\",\"order\":\"desc\"}' \\\n -H 'Content-Type: application/json'\n```\n\n
\n\n
\n\n``` language-bash\nphrase translations verify \\\n--project_id \\\n--data '{\"query\":\"\"my dog unverified:true\"\", \"sort\":\"updated_at\", \"order\":\"desc\"}' \\\n--access_token \n```\n\n
\n\n
\n\n
\n\n
\n\n
\n\n### Find recently updated keys\n\n GET /v2/projects/:project_id/keys\n\nFind updated keys with with the `updated_at` qualifier like\n`updated_at:>=2013-02-21T00:00:00Z`. This example returns keys that have\nbeen updated on or after 2013-02-21.\n\n#### Parameters\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
NameTypeDescription
sort
\noptional
stringSort by field. Can be one of: name, created_at, updated_at.
\nDefault: name
order
\noptional
stringOrder direction. Can be one of: asc, desc.
\nDefault: asc
q
\noptional
stringSpecify a query to do broad search for keys by name (including wildcards).
\n
\nThe following qualifiers are also supported in the search term:
\n\n
    \n
  • ids:key_id,... for queries on a comma-separated list of ids
  • \n
  • name:key_name for text queries on exact key names - spaces, commas, and colons need to be escaped with double backslashes
  • \n
  • tags:tag_name to filter for keys with certain tags
  • \n
  • translated:{true|false} for translation status (also requires locale_id to be specified)
  • \n
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • \n
  • unmentioned_in_upload:upload_id to filter keys unmentioned within upload
  • \n
\nFind more examples here.
locale_id
\n\n
\n\n
\n\n
\n\n#### Example Request\n\n
\n\n``` language-bash\ncurl \"https://api.phrase.com/v2/projects/:project_id/keys?sort=updated_at&order=desc&q=updated_at:%3E=2013-02-21T00:00:00Z&locale_id=abcd1234abcd1234abcd1234abcd1234\" \\\n -u USERNAME_OR_ACCESS_TOKEN\n```\n\n
\n\n
\n\n``` language-bash\nphrase keys list \\\n--project_id \\\n--sort updated_at \\\n--order desc \\\n--query \"updated_at:>=2013-02-21T00:00:00Z\" \\\n--locale_id abcd1234abcd1234abcd1234abcd1234 \\\n--access_token \n```\n\n
\n\n
\n\n
\n\n
\n\n
\n\n### Find keys with a certain tag\n\n GET /v2/projects/:project_id/keys\n\nKeys with certain tags can be filtered with the qualifier `tags:`.\n\n#### Parameters\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
NameTypeDescription
q
\noptional
stringSpecify a query to do broad search for keys by name (including wildcards).
\n
\nThe following qualifiers are also supported in the search term:
\n\n
    \n
  • ids:key_id,... for queries on a comma-separated list of ids
  • \n
  • name:key_name for text queries on exact key names - spaces, commas, and colons need to be escaped with double backslashes
  • \n
  • tags:tag_name to filter for keys with certain tags
  • \n
  • translated:{true|false} for translation status (also requires locale_id to be specified)
  • \n
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • \n
  • unmentioned_in_upload:upload_id to filter keys unmentioned within upload
  • \n
\nFind more examples here.
\n\n
\n\n
\n\n
\n\n#### Example Request\n\n
\n\n``` language-bash\ncurl \"https://api.phrase.com/v2/projects/:project_id/keys?q=tags:admin\" \\\n -u USERNAME_OR_ACCESS_TOKEN\n```\n\n
\n\n
\n\n``` language-bash\nphrase keys list \\\n--project_id \\\n--query \"tags:admin\" \\\n--access_token \n```\n\n
\n\n
\n\n
\n\n
\n\n
\n\n### Add tags to collection of keys\n\n PATCH /v2/projects/:project_id/keys/tag\n\nAdd the tags `landing-page` and `release-1.2` to all keys that start\nwith `dog` and are translated in the locale\n`abcd1234abcd1234abcd1234abcd1234`.\n\n#### Parameters\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
NameTypeDescription
q
\noptional
stringSpecify a query to do broad search for keys by name (including wildcards).
\n
\nThe following qualifiers are also supported in the search term:
\n\n
    \n
  • ids:key_id,... for queries on a comma-separated list of ids
  • \n
  • name:key_name for text queries on exact key names - whitespaces need to be prefixed with a backspace (\"\\\")
  • \n
  • tags:tag_name to filter for keys with certain tags
  • \n
  • translated:{true|false} for translation status (also requires locale_id to be specified)
  • \n
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • \n
  • unmentioned_in_upload:upload_id to filter keys unmentioned within upload
  • \n
\nFind more examples here.
tagsstringTag or comma-separated list of tags to add to the matching collection of keys
locale_id
\noptional
idLocale used to determine the translation state of a key when filtering for untranslated or translated keys.
\n\n
\n\n
\n\n
\n\n#### Example Request\n\n
\n\n``` language-bash\ncurl \"https://api.phrase.com/v2/projects/:project_id/keys/tag\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X PATCH \\\n -d '{\"q\":\"dog* translated:true\",\"tags\":\"landing-page,release-1.2\",\"locale_id\":\"abcd1234abcd1234abcd1234abcd1234\"}' \\\n -H 'Content-Type: application/json'\n```\n\n
\n\n
\n\n``` language-bash\nphrase keys tag \\\n--project_id \\\n--data '{\"query\":\"'dog* translated:true'\", \"tags\":\"landing-page,release-1.2\", \"locale_id\":\"abcd1234abcd1234abcd1234abcd1234\"}' \\\n--access_token \n```\n\n
\n\n
\n\n
\n\n
\n\n
\n\n### Remove tags from collection of keys\n\n PATCH /v2/projects/:project_id/keys/untag\n\nRemove the tags `landing-page` and `release-1.2` from all keys that\nstart with `dog` and are translated in the locale\n`abcd1234abcd1234abcd1234abcd1234`.\n\n#### Parameters\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
NameTypeDescription
q
\noptional
stringSpecify a query to do broad search for keys by name (including wildcards).
\n
\nThe following qualifiers are also supported in the search term:
\n\n
    \n
  • ids:key_id,... for queries on a comma-separated list of ids
  • \n
  • name:key_name for text queries on exact key names - whitespaces need to be prefixed with a backspace (\"\\\")
  • \n
  • tags:tag_name to filter for keys with certain tags
  • \n
  • translated:{true|false} for translation status (also requires locale_id to be specified)
  • \n
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • \n
  • unmentioned_in_upload:upload_id to filter keys unmentioned within upload
  • \n
\nFind more examples here.
tagsstringTag or comma-separated list of tags to remove from the matching collection of keys
locale_id
\noptional
idLocale used to determine the translation state of a key when filtering for untranslated or translated keys.
\n\n
\n\n
\n\n
\n\n#### Example Request\n\n
\n\n``` language-bash\ncurl \"https://api.phrase.com/v2/projects/:project_id/keys/untag\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X PATCH \\\n -d '{\"q\":\"dog* translated:true\",\"tags\":\"landing-page,release-1.2\",\"locale_id\":\"abcd1234abcd1234abcd1234abcd1234\"}' \\\n -H 'Content-Type: application/json'\n```\n\n
\n\n
\n\n``` language-bash\nphrase keys untag \\\n--project_id \\\n--data '{\"query\":\"'dog* translated:true'\", \"tags\":\"landing-page,release-1.2\", \"locale_id\":\"abcd1234abcd1234abcd1234abcd1234\"}' \\\n--access_token \n```\n\n
\n\n
\n\n
\n\n
\n\n
\n\n### Find keys with broad text match\n\n GET /v2/projects/:project_id/keys\n\nExample query `my dog`\n\n#### Parameters\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
NameTypeDescription
q
\noptional
stringSpecify a query to do broad search for keys by name (including wildcards).
\n
\nThe following qualifiers are also supported in the search term:
\n\n
    \n
  • ids:key_id,... for queries on a comma-separated list of ids
  • \n
  • name:key_name for text queries on exact key names - whitespaces need to be prefixed with a backspace (\"\\\")
  • \n
  • tags:tag_name to filter for keys with certain tags
  • \n
  • translated:{true|false} for translation status (also requires locale_id to be specified)
  • \n
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • \n
  • unmentioned_in_upload:upload_id to filter keys unmentioned within upload
  • \n
\nFind more examples here.
\n\n
\n\n#### Matches\n\n**My dog** is lazy\n **my dog** is lazy\n angry **dog** in **my** house\n\n
\n\n
\n\n#### Example Request\n\n
\n\n``` language-bash\ncurl \"https://api.phrase.com/v2/projects/:project_id/keys?q=my%20dog\" \\\n -u USERNAME_OR_ACCESS_TOKEN\n```\n\n
\n\n
\n\n``` language-bash\nphrase keys list \\\n--project_id \\\n--query \"my dog\" \\\n--access_token \n```\n\n
\n\n
\n\n
\n\n
\n\n
\n\n### Find keys with exact text match\n\n GET /v2/projects/:project_id/keys\n\nExample query `\"my dog is lazy\"` (note backslashes before any whitespace\ncharacter in the example query)\n\n#### Parameters\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
NameTypeDescription
q
\noptional
stringSpecify a query to do broad search for keys by name (including wildcards).
\n
\nThe following qualifiers are also supported in the search term:
\n\n
    \n
  • ids:key_id,... for queries on a comma-separated list of ids
  • \n
  • name:key_name for text queries on exact key names - whitespaces need to be prefixed with a backspace (\"\\\")
  • \n
  • tags:tag_name to filter for keys with certain tags
  • \n
  • translated:{true|false} for translation status (also requires locale_id to be specified)
  • \n
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • \n
  • unmentioned_in_upload:upload_id to filter keys unmentioned within upload
  • \n
\nFind more examples here.
\n\n
\n\n#### Matches\n\n~~My dog is lazy~~\n**my dog is lazy**\n ~~angry dog in my house~~\n\n
\n\n
\n\n#### Example Request\n\n
\n\n``` language-bash\ncurl \"https://api.phrase.com/v2/projects/:project_id/keys?q=name:my%5C%20dog%5C%20is%5C%20lazy\" \\\n -u USERNAME_OR_ACCESS_TOKEN\n```\n\n
\n\n
\n\n``` language-bash\nphrase keys list \\\n--project_id \\\n--query \"name:my\\ dog\\ is\\ lazy\" \\\n--access_token \n```\n\n
\n\n
\n\n
\n\n
\n\n
\n\n### Find keys with wildcard character matching\n\n GET /v2/projects/:project_id/keys\n\nExample query `*dog is*`\n\n#### Parameters\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
NameTypeDescription
q
\noptional
stringSpecify a query to do broad search for keys by name (including wildcards).
\n
\nThe following qualifiers are also supported in the search term:
\n\n
    \n
  • ids:key_id,... for queries on a comma-separated list of ids
  • \n
  • name:key_name for text queries on exact key names - whitespaces need to be prefixed with a backspace (\"\\\")
  • \n
  • tags:tag_name to filter for keys with certain tags
  • \n
  • translated:{true|false} for translation status (also requires locale_id to be specified)
  • \n
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • \n
  • unmentioned_in_upload:upload_id to filter keys unmentioned within upload
  • \n
\nFind more examples here.
\n\n
\n\n#### Matches\n\nMy **dog is** lazy\n my **dog is** lazy\n ~~angry dog in my house~~\n\n
\n\n
\n\n#### Example Request\n\n
\n\n``` language-bash\ncurl \"https://api.phrase.com/v2/projects/:project_id/keys?q=*dog%20is*\" \\\n -u USERNAME_OR_ACCESS_TOKEN\n```\n\n
\n\n
\n\n``` language-bash\nphrase keys list \\\n--project_id \\\n--query '*dog is*' \\\n--access_token \n```\n\n
\n\n
\n\n
\n\n
\n\n
\n\n### Upload an Excel file with several translations\n\n POST /v2/projects/:project_id/uploads\n\nSuppose you have an excel file where the 'A' column contains the key\nnames, the 'B' column contains English translations, the 'C' column\ncontains German translations and the 'D' column contains comments.\nFurthermore, the actual content starts in the second row, since the\nfirst row is reserved for a header. You can upload this file and import\nall translations at once\\!\n\n#### Parameters\n\n
\n\n| Name | Type | Description |\n| ----------------------------------- | -------- | ----------------------------------------------------------- |\n| `file` | `file` | File to be imported |\n| `file_format` | `string` | File format. Auto-detected when possible and not specified. |\n| `locale_mapping[en]` | `string` | Name of the column containing translations for locale en. |\n| `locale_mapping[de]` | `string` | Name of the column containing translations for locale de. |\n| `format_options[comment_column]` | `string` | Name of the column containing descriptions for keys. |\n| `format_options[tag_column]` | `string` | Name of the column containing tags for keys. |\n| `format_options[key_name_column]` | `string` | Name of the column containing the names of the keys. |\n| `format_options[first_content_row]` | `string` | Name of the first row containing actual translations. |\n\n
\n\n
\n\n
\n\n#### Example Request\n\n
\n\n``` language-bash\ncurl \"https://api.phrase.com/v2/projects/:project_id/uploads\" \\\n -u USERNAME_OR_ACCESS_TOKEN \\\n -X POST \\\n -F file=@/path/to/my/file.xlsx \\\n -F file_format=xlsx \\\n -F locale_mapping[en]=B \\\n -F locale_mapping[de]=C \\\n -F format_options[comment_column]=D \\\n -F format_options[tag_column]=E \\\n -F format_options[key_name_column]=A \\\n -F format_options[first_content_row]=2\n```\n\n
\n\n
\n\n``` language-bash\nphrase uploads create \\\n--project_id \\\n--file /path/to/my/file.xlsx \\\n--file_format xlsx \\\n--locale_id abcd1234cdef1234abcd1234cdef1234 \\\n--tags awesome-feature,needs-proofreading \\\n--locale_mapping '{\"en\": \"B\", \"de\": \"C\"}' \\\n--format_options '{\"comment_column\": \"D\", \"tag_column\": \"E\", \"key_name_column\": \"A\", \"first_content_row\": \"2\"}' \\\n--access_token \n```\n\n
\n\n
\n\n
\n\n
\n", + "description": "Phrase Strings is a translation management platform for software projects. You can collaborate on language file translation\nwith your team or order translations through our platform. The API allows you to import locale files, download locale files,\ntag keys or interact in other ways with the localization data stored in Phrase Strings for your account.\n", "contact": { "name": "Phrase Support", "url": "https://developers.phrase.com/api/", diff --git a/main.yaml b/main.yaml index f2e2d412..37359455 100644 --- a/main.yaml +++ b/main.yaml @@ -3,8 +3,10 @@ openapi: 3.0.3 info: title: Phrase Strings API Reference version: 2.0.0 - description: - $ref: "./intro.md" + description: | + Phrase Strings is a translation management platform for software projects. You can collaborate on language file translation + with your team or order translations through our platform. The API allows you to import locale files, download locale files, + tag keys or interact in other ways with the localization data stored in Phrase Strings for your account. contact: name: Phrase Support diff --git a/openapi-generator/cli_lang.yaml b/openapi-generator/cli_lang.yaml index 18c8ba16..d3c6a148 100644 --- a/openapi-generator/cli_lang.yaml +++ b/openapi-generator/cli_lang.yaml @@ -4,3 +4,4 @@ outputDir: clients/cli packageName: phrase packageVersion: 2.14.0 templateDir: openapi-generator/templates/cli +apiNameSuffix: Api diff --git a/openapi-generator/go_lang.yaml b/openapi-generator/go_lang.yaml index ff74490d..0c326c8a 100644 --- a/openapi-generator/go_lang.yaml +++ b/openapi-generator/go_lang.yaml @@ -7,3 +7,4 @@ gitUserId: phrase gitRepoId: phrase-go httpUserAgent: Phrase Strings go templateDir: openapi-generator/templates/go +apiNameSuffix: Api \ No newline at end of file diff --git a/openapi-generator/templates/cli/api.handlebars b/openapi-generator/templates/cli/api.handlebars index 9b9ebdeb..169df036 100644 --- a/openapi-generator/templates/cli/api.handlebars +++ b/openapi-generator/templates/cli/api.handlebars @@ -86,7 +86,7 @@ func init{{{nickname}}}() { {{else~}} {{#isPrimitiveType~}} if params.IsSet(helpers.ToSnakeCase("{{paramName}}")) { - localVarOptionals.{{{vendorExtensions.x-export-param-name}}} = optional.New{{{vendorExtensions.x-optional-data-type}}}(params.Get{{{vendorExtensions.x-optional-data-type}}}(helpers.ToSnakeCase("{{{vendorExtensions.x-export-param-name}}}"))) + localVarOptionals.{{{vendorExtensions.x-export-param-name}}} = optional.New{{capitalizeFirst dataType}}(params.Get{{{capitalizeFirst dataType}}}(helpers.ToSnakeCase("{{{vendorExtensions.x-export-param-name}}}"))) } {{/isPrimitiveType~}} {{#isModel~}} @@ -111,7 +111,7 @@ func init{{{nickname}}}() { {{/required~}} {{/allParams~}} - data, api_response, err := client.{{classname}}.{{{nickname}}}(auth{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}&localVarOptionals{{/hasOptionalParams}}) + data, api_response, err := client.{{classname}}.{{{nickname}}}(auth{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}}{{#unless @last}}, {{/unless}}{{/required}}{{/allParams}}{{#hasOptionalParams}}&localVarOptionals{{/hasOptionalParams}}) if err != nil { switch castedError := err.(type) { diff --git a/openapi-generator/templates/cli/api_test.hbs b/openapi-generator/templates/cli/api_test.hbs new file mode 100644 index 00000000..e69de29b diff --git a/openapi-generator/templates/cli/client.hbs b/openapi-generator/templates/cli/client.hbs new file mode 100644 index 00000000..e69de29b diff --git a/openapi-generator/templates/cli/configuration.hbs b/openapi-generator/templates/cli/configuration.hbs new file mode 100644 index 00000000..e69de29b diff --git a/openapi-generator/templates/cli/response.hbs b/openapi-generator/templates/cli/response.hbs new file mode 100644 index 00000000..e69de29b diff --git a/openapi-generator/templates/cli/utils.hbs b/openapi-generator/templates/cli/utils.hbs new file mode 100644 index 00000000..e69de29b diff --git a/openapi-generator/templates/go/README.mustache b/openapi-generator/templates/go/README.mustache index c29af0de..d1bdce83 100644 --- a/openapi-generator/templates/go/README.mustache +++ b/openapi-generator/templates/go/README.mustache @@ -41,7 +41,22 @@ func main() { } ``` -{{>../shared/datacenters}} +## Datacenters + +The API is only accessible via HTTPS and the current version is v2, which results in a base URL like: {{{basePath}}} depending on the datacenter. + +### EU Datacenter +``` +{{{basePath}}} +``` + +This is the default datacenter. + +### US Datacenter +``` +https://api.us.app.phrase.com/v2/ +``` + ### Specifying US Datacenter You can use the US datacenter by setting the following: ``` @@ -77,8 +92,8 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) ## Author -{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} -{{/hasMore}}{{/apis}}{{/apiInfo}} +{{#apiInfo}}{{#apis}}{{^-last}}{{infoEmail}} +{{/-last}}{{/apis}}{{/apiInfo}} ## Get help / support diff --git a/openapi-generator/templates/go/api.mustache b/openapi-generator/templates/go/api.mustache index 4bdbd763..580b7857 100644 --- a/openapi-generator/templates/go/api.mustache +++ b/openapi-generator/templates/go/api.mustache @@ -10,6 +10,7 @@ import ( _neturl "net/url" {{#imports}} "{{import}}" {{/imports}} + "github.com/antihax/optional" ) // Linger please @@ -28,7 +29,7 @@ type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts struct { {{^required}} {{#isPrimitiveType}} {{^isBinary}} - {{vendorExtensions.x-export-param-name}} optional.{{vendorExtensions.x-optional-data-type}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` + {{vendorExtensions.x-export-param-name}} optional.{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` {{/isBinary}} {{#isBinary}} {{vendorExtensions.x-export-param-name}} optional.Interface `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` @@ -57,7 +58,7 @@ type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts struct { * @param optional nil or *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts - Optional Parameters: {{#allParams}} {{^required}} - * @param "{{vendorExtensions.x-export-param-name}}" ({{#isPrimitiveType}}{{^isBinary}}optional.{{vendorExtensions.x-optional-data-type}}{{/isBinary}}{{#isBinary}}optional.Interface of {{dataType}}{{/isBinary}}{{/isPrimitiveType}}{{^isPrimitiveType}}optional.Interface of {{dataType}}{{/isPrimitiveType}}) - {{#description}} {{{.}}}{{/description}} + * @param "{{vendorExtensions.x-export-param-name}}" ({{#isPrimitiveType}}{{^isBinary}}optional.{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}{{/isBinary}}{{#isBinary}}optional.Interface of {{dataType}}{{/isBinary}}{{/isPrimitiveType}}{{^isPrimitiveType}}optional.Interface of {{dataType}}{{/isPrimitiveType}}) - {{#description}} {{{.}}}{{/description}} {{/required}} {{/allParams}} {{/hasOptionalParams}} @@ -65,7 +66,7 @@ type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts struct { @return {{{returnType}}} {{/returnType}} */ -func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}{{^returnType}}[]byte, {{/returnType}}*APIResponse, error) { +func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}{{^returnType}}[]byte, {{/returnType}}*APIResponse, error) { var ( localVarHTTPMethod = _nethttp.Method{{httpMethod}} localVarPostBody interface{} @@ -337,9 +338,9 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams return {{#returnType}}localVarReturnValue, {{/returnType}}{{^returnType}}nil, {{/returnType}}localVarHTTPResponse, newErr } newErr.model = v - {{#hasMore}} + {{^-last}} return {{#returnType}}localVarReturnValue, {{/returnType}}{{^returnType}}nil, {{/returnType}}localVarHTTPResponse, newErr - {{/hasMore}} + {{/-last}} {{^wildcard}} } {{/wildcard}} diff --git a/openapi-generator/templates/go/api_doc.mustache b/openapi-generator/templates/go/api_doc.mustache index 5ddad640..6523f23a 100644 --- a/openapi-generator/templates/go/api_doc.mustache +++ b/openapi-generator/templates/go/api_doc.mustache @@ -14,7 +14,7 @@ Method | HTTP request | Description ## {{{operationId}}} -> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}(ctx, {{#allParams}}{{#required}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}optional{{/hasOptionalParams}}) +> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}(ctx, {{#allParams}}{{#required}}{{paramName}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}optional{{/hasOptionalParams}}) {{{summary}}}{{#notes}} @@ -36,7 +36,7 @@ Optional parameters are passed through a pointer to a {{{nickname}}}Opts struct Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}} -{{^required}} **{{paramName}}** | {{#isFile}}**optional.Interface of {{dataType}}**{{/isFile}}{{#isPrimitiveType}}**optional.{{vendorExtensions.x-optional-data-type}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**optional.Interface of {{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{/hasOptionalParams}} +{{^required}} **{{paramName}}** | {{#isFile}}**optional.Interface of {{dataType}}**{{/isFile}}{{#isPrimitiveType}}**optional.{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**optional.Interface of {{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{/hasOptionalParams}} ### Return type @@ -48,8 +48,8 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} -- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} +- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} +- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) diff --git a/openapi-generator/templates/java/README.mustache b/openapi-generator/templates/java/README.mustache index 6ea02f40..cd09bd8a 100644 --- a/openapi-generator/templates/java/README.mustache +++ b/openapi-generator/templates/java/README.mustache @@ -105,7 +105,7 @@ public class {{{classname}}}Example { {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} {{/allParams}} try { - {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} System.out.println(result);{{/returnType}} } catch (ApiException e) { System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); @@ -167,8 +167,8 @@ It's recommended to create an instance of `ApiClient` per thread in a multithrea ## Author -{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} -{{/hasMore}}{{/apis}}{{/apiInfo}} +{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} +{{/-last}}{{/apis}}{{/apiInfo}} ## Get help / support diff --git a/openapi-generator/templates/java/api.mustache b/openapi-generator/templates/java/api.mustache index 11fc64de..894cb011 100644 --- a/openapi-generator/templates/java/api.mustache +++ b/openapi-generator/templates/java/api.mustache @@ -63,7 +63,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set @@ -99,16 +99,16 @@ public class {{classname}} { {{/formParams}} final String[] localVarAccepts = { - {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} }; + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; {{#returnType}} GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {}; diff --git a/openapi-generator/templates/java/api_doc.mustache b/openapi-generator/templates/java/api_doc.mustache index 2d8725ee..f5b2f75b 100644 --- a/openapi-generator/templates/java/api_doc.mustache +++ b/openapi-generator/templates/java/api_doc.mustache @@ -14,7 +14,7 @@ Method | HTTP request | Description ## {{operationId}} -> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) +> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) {{summary}}{{#notes}} @@ -61,7 +61,7 @@ public class Example { {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} {{/allParams}} try { - {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} System.out.println(result);{{/returnType}} } catch (ApiException e) { System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); @@ -92,8 +92,8 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} -- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} +- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} +- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} {{#responses.0}} ### HTTP response details diff --git a/openapi-generator/templates/java/api_test.mustache b/openapi-generator/templates/java/api_test.mustache index 7011191c..38c58efb 100644 --- a/openapi-generator/templates/java/api_test.mustache +++ b/openapi-generator/templates/java/api_test.mustache @@ -42,7 +42,7 @@ public class {{classname}}Test { //{{#allParams}} //{{{dataType}}} {{paramName}} = null; //{{/allParams}} - //{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + //{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); // TODO: test validations } diff --git a/openapi-generator/templates/java/jackson_annotations.mustache b/openapi-generator/templates/java/jackson_annotations.mustache index ac01b293..3819d3d2 100644 --- a/openapi-generator/templates/java/jackson_annotations.mustache +++ b/openapi-generator/templates/java/jackson_annotations.mustache @@ -5,7 +5,7 @@ * Else use custom behaviour, IOW use whatever is defined on the object mapper }} @JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}) - @JsonInclude({{#isMapContainer}}{{#items.isNullable}}content = JsonInclude.Include.ALWAYS, {{/items.isNullable}}{{/isMapContainer}}value = JsonInclude.Include.{{#required}}ALWAYS{{/required}}{{^required}}USE_DEFAULTS{{/required}}) + @JsonInclude({{#isMap}}{{#items.isNullable}}content = JsonInclude.Include.ALWAYS, {{/items.isNullable}}{{/isMap}}value = JsonInclude.Include.{{#required}}ALWAYS{{/required}}{{^required}}USE_DEFAULTS{{/required}}) {{#withXml}} {{^isContainer}} @JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") diff --git a/openapi-generator/templates/java/libraries/feign/ApiClient.mustache b/openapi-generator/templates/java/libraries/feign/ApiClient.mustache index 47e99301..b58a167b 100644 --- a/openapi-generator/templates/java/libraries/feign/ApiClient.mustache +++ b/openapi-generator/templates/java/libraries/feign/ApiClient.mustache @@ -73,7 +73,7 @@ public class ApiClient { auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"); {{/isApiKey}} {{#isOAuth}} - auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}"); + auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}"); {{/isOAuth}} } else {{/authMethods}}{ throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); diff --git a/openapi-generator/templates/java/libraries/feign/api.mustache b/openapi-generator/templates/java/libraries/feign/api.mustache index cff48fcd..f6319c5d 100644 --- a/openapi-generator/templates/java/libraries/feign/api.mustache +++ b/openapi-generator/templates/java/libraries/feign/api.mustache @@ -35,14 +35,14 @@ public interface {{classname}} extends ApiClient.Api { * @see {{summary}} Documentation {{/externalDocs}} */ - @RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{#hasMore}}&{{/hasMore}}{{/queryParams}}") + @RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") @Headers({ {{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", {{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} - "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{#hasMore}}, - {{/hasMore}}{{/headerParams}} + "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, + {{/-last}}{{/headerParams}} }) - {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{baseName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{baseName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); {{#hasQueryParams}} /** @@ -73,12 +73,12 @@ public interface {{classname}} extends ApiClient.Api { * @see {{summary}} Documentation {{/externalDocs}} */ - @RequestLine("{{httpMethod}} {{{path}}}?{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{#hasMore}}&{{/hasMore}}{{/queryParams}}") + @RequestLine("{{httpMethod}} {{{path}}}?{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") @Headers({ {{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", {{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} - "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{#hasMore}}, - {{/hasMore}}{{/headerParams}} + "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, + {{/-last}}{{/headerParams}} }) {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{baseName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) Map queryParams); diff --git a/openapi-generator/templates/java/libraries/feign/api_test.mustache b/openapi-generator/templates/java/libraries/feign/api_test.mustache index bcc14a98..b24c9327 100644 --- a/openapi-generator/templates/java/libraries/feign/api_test.mustache +++ b/openapi-generator/templates/java/libraries/feign/api_test.mustache @@ -36,7 +36,7 @@ public class {{classname}}Test { {{#allParams}} {{{dataType}}} {{paramName}} = null; {{/allParams}} - // {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + // {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); // TODO: test validations } @@ -59,7 +59,7 @@ public class {{classname}}Test { {{/allParams}} {{classname}}.{{operationIdCamelCase}}QueryParams queryParams = new {{classname}}.{{operationIdCamelCase}}QueryParams() {{#queryParams}} - .{{paramName}}(null){{^hasMore}};{{/hasMore}} + .{{paramName}}(null){{#-last}};{{/-last}} {{/queryParams}} // {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{^isQueryParam}}{{paramName}}, {{/isQueryParam}}{{/allParams}}queryParams); diff --git a/openapi-generator/templates/java/libraries/google-api-client/api.mustache b/openapi-generator/templates/java/libraries/google-api-client/api.mustache index 2c13f4eb..2cd0f49b 100644 --- a/openapi-generator/templates/java/libraries/google-api-client/api.mustache +++ b/openapi-generator/templates/java/libraries/google-api-client/api.mustache @@ -56,8 +56,8 @@ public class {{classname}} { {{/externalDocs}} **/ - public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws IOException { - {{#returnType}}HttpResponse response = {{/returnType}}{{operationId}}ForHttpResponse({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws IOException { + {{#returnType}}HttpResponse response = {{/returnType}}{{operationId}}ForHttpResponse({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} TypeReference<{{{returnType}}}> typeRef = new TypeReference<{{{returnType}}}>() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);{{/returnType}} } @@ -75,13 +75,13 @@ public class {{classname}} { {{/externalDocs}} **/ - public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#bodyParam}}{{^required}}{{{dataType}}} {{paramName}}, {{/required}}{{/bodyParam}}{{#requiredParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#hasRequiredParams}}, {{/hasRequiredParams}}Map params) throws IOException { - {{#returnType}}HttpResponse response = {{/returnType}}{{operationId}}ForHttpResponse({{#bodyParam}}{{^required}}{{paramName}}, {{/required}}{{/bodyParam}}{{#requiredParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#hasRequiredParams}}, {{/hasRequiredParams}}params);{{#returnType}} + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#bodyParam}}{{^required}}{{{dataType}}} {{paramName}}, {{/required}}{{/bodyParam}}{{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#hasRequiredParams}}, {{/hasRequiredParams}}Map params) throws IOException { + {{#returnType}}HttpResponse response = {{/returnType}}{{operationId}}ForHttpResponse({{#bodyParam}}{{^required}}{{paramName}}, {{/required}}{{/bodyParam}}{{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#hasRequiredParams}}, {{/hasRequiredParams}}params);{{#returnType}} TypeReference<{{{returnType}}}> typeRef = new TypeReference<{{{returnType}}}>() {}; return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);{{/returnType}} } - public HttpResponse {{operationId}}ForHttpResponse({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws IOException { + public HttpResponse {{operationId}}ForHttpResponse({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws IOException { {{#allParams}}{{#required}}// verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { throw new IllegalArgumentException("Missing the required parameter '{{paramName}}' when calling {{operationId}}"); @@ -112,7 +112,7 @@ public class {{classname}} { return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content).execute(); }{{#bodyParam}} - public HttpResponse {{operationId}}ForHttpResponse({{#allParams}}{{#isBodyParam}}java.io.InputStream {{paramName}}{{/isBodyParam}}{{^isBodyParam}}{{{dataType}}} {{paramName}}{{/isBodyParam}}{{#hasMore}}, {{/hasMore}}{{/allParams}}, String mediaType) throws IOException { + public HttpResponse {{operationId}}ForHttpResponse({{#allParams}}{{#isBodyParam}}java.io.InputStream {{paramName}}{{/isBodyParam}}{{^isBodyParam}}{{{dataType}}} {{paramName}}{{/isBodyParam}}{{^-last}}, {{/-last}}{{/allParams}}, String mediaType) throws IOException { {{#allParams}}{{#required}}// verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { throw new IllegalArgumentException("Missing the required parameter '{{paramName}}' when calling {{operationId}}"); @@ -145,7 +145,7 @@ public class {{classname}} { return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content).execute(); }{{/bodyParam}} - public HttpResponse {{operationId}}ForHttpResponse({{#bodyParam}}{{^required}}{{{dataType}}} {{paramName}}, {{/required}}{{/bodyParam}}{{#requiredParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#hasRequiredParams}}, {{/hasRequiredParams}}Map params) throws IOException { + public HttpResponse {{operationId}}ForHttpResponse({{#bodyParam}}{{^required}}{{{dataType}}} {{paramName}}, {{/required}}{{/bodyParam}}{{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#hasRequiredParams}}, {{/hasRequiredParams}}Map params) throws IOException { {{#allParams}}{{#required}}// verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { throw new IllegalArgumentException("Missing the required parameter '{{paramName}}' when calling {{operationId}}"); diff --git a/openapi-generator/templates/java/libraries/google-api-client/api_test.mustache b/openapi-generator/templates/java/libraries/google-api-client/api_test.mustache index 365106fb..56b7c189 100644 --- a/openapi-generator/templates/java/libraries/google-api-client/api_test.mustache +++ b/openapi-generator/templates/java/libraries/google-api-client/api_test.mustache @@ -37,7 +37,7 @@ public class {{classname}}Test { {{#allParams}} {{{dataType}}} {{paramName}} = null; {{/allParams}} - {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); // TODO: test validations } diff --git a/openapi-generator/templates/java/libraries/jersey2-experimental/api.mustache b/openapi-generator/templates/java/libraries/jersey2-experimental/api.mustache index 509ae48a..37dbbfe9 100644 --- a/openapi-generator/templates/java/libraries/jersey2-experimental/api.mustache +++ b/openapi-generator/templates/java/libraries/jersey2-experimental/api.mustache @@ -81,8 +81,8 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { - {{#returnType}}return {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}.getData(){{/returnType}}; + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#returnType}}return {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}}.getData(){{/returnType}}; } {{/vendorExtensions.x-group-parameters}} @@ -115,7 +115,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set @@ -150,16 +150,16 @@ public class {{classname}} { {{/formParams}} final String[] localVarAccepts = { - {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} }; + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; {{#returnType}} GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {}; @@ -176,7 +176,7 @@ public class {{classname}} { private {{#isRequired}}final {{/isRequired}}{{{dataType}}} {{localVariablePrefix}}{{paramName}}; {{/allParams}} - private API{{operationId}}Request({{#pathParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}) { + private API{{operationId}}Request({{#pathParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}) { {{#pathParams}} this.{{localVariablePrefix}}{{paramName}} = {{paramName}}; {{/pathParams}} @@ -236,7 +236,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException { - return {{operationId}}WithHttpInfo({{#allParams}}{{localVariablePrefix}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + return {{operationId}}WithHttpInfo({{#allParams}}{{localVariablePrefix}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); } } @@ -253,8 +253,8 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public API{{operationId}}Request {{operationId}}({{#pathParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}) throws ApiException { - return new API{{operationId}}Request({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}); + public API{{operationId}}Request {{operationId}}({{#pathParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}) throws ApiException { + return new API{{operationId}}Request({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}); } {{/vendorExtensions.x-group-parameters}} {{/operation}} diff --git a/openapi-generator/templates/java/libraries/jersey2-experimental/api_doc.mustache b/openapi-generator/templates/java/libraries/jersey2-experimental/api_doc.mustache index f162d1cc..edb4166e 100644 --- a/openapi-generator/templates/java/libraries/jersey2-experimental/api_doc.mustache +++ b/openapi-generator/templates/java/libraries/jersey2-experimental/api_doc.mustache @@ -15,10 +15,10 @@ Method | HTTP request | Description ## {{operationId}} {{^vendorExtensions.x-group-parameters}} -> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) +> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) {{/vendorExtensions.x-group-parameters}} {{#vendorExtensions.x-group-parameters}} -> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}.execute(); +> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}.execute(); {{/vendorExtensions.x-group-parameters}} {{summary}}{{#notes}} @@ -66,10 +66,10 @@ public class Example { {{/allParams}} try { {{^vendorExtensions.x-group-parameters}} - {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}); {{/vendorExtensions.x-group-parameters}} {{#vendorExtensions.x-group-parameters}} - {{#returnType}}{{{returnType}}} result = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}} + {{#returnType}}{{{returnType}}} result = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}} .{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}} .execute(); {{/vendorExtensions.x-group-parameters}} @@ -105,8 +105,8 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} -- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} +- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} +- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} {{#responses.0}} ### HTTP response details diff --git a/openapi-generator/templates/java/libraries/jersey2-experimental/api_test.mustache b/openapi-generator/templates/java/libraries/jersey2-experimental/api_test.mustache index 5ee6e494..9fd2d218 100644 --- a/openapi-generator/templates/java/libraries/jersey2-experimental/api_test.mustache +++ b/openapi-generator/templates/java/libraries/jersey2-experimental/api_test.mustache @@ -38,10 +38,10 @@ public class {{classname}}Test { //{{{dataType}}} {{paramName}} = null; {{/allParams}} {{^vendorExtensions.x-group-parameters}} - //{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + //{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); {{/vendorExtensions.x-group-parameters}} {{#vendorExtensions.x-group-parameters}} - //{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}} + //{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}} // .{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}} // .execute(); {{/vendorExtensions.x-group-parameters}} diff --git a/openapi-generator/templates/java/libraries/jersey2-experimental/pojo.mustache b/openapi-generator/templates/java/libraries/jersey2-experimental/pojo.mustache index c438cd43..9e73d742 100644 --- a/openapi-generator/templates/java/libraries/jersey2-experimental/pojo.mustache +++ b/openapi-generator/templates/java/libraries/jersey2-experimental/pojo.mustache @@ -103,7 +103,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE {{^vendorExtensions.x-is-jackson-optional-nullable}}this.{{name}} = {{name}};{{/vendorExtensions.x-is-jackson-optional-nullable}} return this; } - {{#isListContainer}} + {{#isArray}} public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} @@ -127,8 +127,8 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} } - {{/isListContainer}} - {{#isMapContainer}} + {{/isArray}} + {{#isMap}} public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} @@ -152,7 +152,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} } - {{/isMapContainer}} + {{/isMap}} {{/isReadOnly}} /** @@ -241,8 +241,8 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE return false; }{{#hasVars}} {{classname}} {{classVarName}} = ({{classname}}) o; - return {{#vars}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} && - {{/hasMore}}{{/vars}}{{#parent}} && + return {{#vars}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} && + {{/-last}}{{/vars}}{{#parent}} && super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}} {{/useReflectionEqualsHashCode}} @@ -254,7 +254,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE return HashCodeBuilder.reflectionHashCode(this); {{/useReflectionEqualsHashCode}} {{^useReflectionEqualsHashCode}} - return Objects.hash({{#vars}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); + return Objects.hash({{#vars}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); {{/useReflectionEqualsHashCode}} } @@ -269,15 +269,15 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE return false; }{{#hasVars}} {{classname}} {{classVarName}} = ({{classname}}) o; - return {{#vars}}ObjectUtils.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} && - {{/hasMore}}{{/vars}}{{#parent}} && + return {{#vars}}ObjectUtils.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} && + {{/-last}}{{/vars}}{{#parent}} && super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} return true;{{/hasVars}} } @Override public int hashCode() { - return ObjectUtils.hashCodeMulti({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); + return ObjectUtils.hashCodeMulti({{#vars}}{{name}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); } {{/supportJava6}} diff --git a/openapi-generator/templates/java/libraries/jersey2/api.mustache b/openapi-generator/templates/java/libraries/jersey2/api.mustache index 4a2e61af..95d88f1b 100644 --- a/openapi-generator/templates/java/libraries/jersey2/api.mustache +++ b/openapi-generator/templates/java/libraries/jersey2/api.mustache @@ -70,8 +70,8 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { - {{#returnType}}return {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}.getData(){{/returnType}}; + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#returnType}}return {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}}.getData(){{/returnType}}; } {{/vendorExtensions.x-group-parameters}} @@ -104,7 +104,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set @@ -139,16 +139,16 @@ public class {{classname}} { {{/formParams}} final String[] localVarAccepts = { - {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} }; + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; {{#returnType}}GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {};{{/returnType}} return apiClient.invokeAPI("{{classname}}.{{operationId}}", localVarPath, "{{httpMethod}}", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}}); @@ -160,7 +160,7 @@ public class {{classname}} { private {{#isRequired}}final {{/isRequired}}{{{dataType}}} {{localVariablePrefix}}{{paramName}}; {{/allParams}} - private API{{operationId}}Request({{#pathParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}) { + private API{{operationId}}Request({{#pathParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}) { {{#pathParams}} this.{{localVariablePrefix}}{{paramName}} = {{paramName}}; {{/pathParams}} @@ -215,7 +215,7 @@ public class {{classname}} { */ {{#isDeprecated}}@Deprecated{{/isDeprecated}} public ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException { - return {{operationId}}WithHttpInfo({{#allParams}}{{localVariablePrefix}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + return {{operationId}}WithHttpInfo({{#allParams}}{{localVariablePrefix}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); } } @@ -230,8 +230,8 @@ public class {{classname}} { * @see {{summary}} Documentation{{/externalDocs}} */ {{#isDeprecated}}@Deprecated{{/isDeprecated}} - public API{{operationId}}Request {{operationId}}({{#pathParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}) throws ApiException { - return new API{{operationId}}Request({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}); + public API{{operationId}}Request {{operationId}}({{#pathParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}) throws ApiException { + return new API{{operationId}}Request({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}); } {{/vendorExtensions.x-group-parameters}} {{/operation}} diff --git a/openapi-generator/templates/java/libraries/jersey2/api_doc.mustache b/openapi-generator/templates/java/libraries/jersey2/api_doc.mustache index f162d1cc..edb4166e 100644 --- a/openapi-generator/templates/java/libraries/jersey2/api_doc.mustache +++ b/openapi-generator/templates/java/libraries/jersey2/api_doc.mustache @@ -15,10 +15,10 @@ Method | HTTP request | Description ## {{operationId}} {{^vendorExtensions.x-group-parameters}} -> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) +> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) {{/vendorExtensions.x-group-parameters}} {{#vendorExtensions.x-group-parameters}} -> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}.execute(); +> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}.execute(); {{/vendorExtensions.x-group-parameters}} {{summary}}{{#notes}} @@ -66,10 +66,10 @@ public class Example { {{/allParams}} try { {{^vendorExtensions.x-group-parameters}} - {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}); {{/vendorExtensions.x-group-parameters}} {{#vendorExtensions.x-group-parameters}} - {{#returnType}}{{{returnType}}} result = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}} + {{#returnType}}{{{returnType}}} result = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}} .{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}} .execute(); {{/vendorExtensions.x-group-parameters}} @@ -105,8 +105,8 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} -- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} +- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} +- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} {{#responses.0}} ### HTTP response details diff --git a/openapi-generator/templates/java/libraries/jersey2/api_test.mustache b/openapi-generator/templates/java/libraries/jersey2/api_test.mustache index 21e0f97d..45a6670e 100644 --- a/openapi-generator/templates/java/libraries/jersey2/api_test.mustache +++ b/openapi-generator/templates/java/libraries/jersey2/api_test.mustache @@ -38,10 +38,10 @@ public class {{classname}}Test { {{{dataType}}} {{paramName}} = null; {{/allParams}} {{^vendorExtensions.x-group-parameters}} - {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); {{/vendorExtensions.x-group-parameters}} {{#vendorExtensions.x-group-parameters}} - {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}} + {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}} .{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}} .execute(); {{/vendorExtensions.x-group-parameters}} diff --git a/openapi-generator/templates/java/libraries/microprofile/api.mustache b/openapi-generator/templates/java/libraries/microprofile/api.mustache index 1830838d..a2c98779 100644 --- a/openapi-generator/templates/java/libraries/microprofile/api.mustache +++ b/openapi-generator/templates/java/libraries/microprofile/api.mustache @@ -49,12 +49,12 @@ public interface {{classname}} { @{{httpMethod}} {{#subresourceOperation}}@Path("{{{path}}}"){{/subresourceOperation}} {{#hasConsumes}} - @Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }) + @Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }) {{/hasConsumes}} {{#hasProduces}} - @Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }) + @Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }) {{/hasProduces}} - public {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException, ProcessingException; + public {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException, ProcessingException; {{/operation}} } {{/operations}} diff --git a/openapi-generator/templates/java/libraries/microprofile/api_test.mustache b/openapi-generator/templates/java/libraries/microprofile/api_test.mustache index 8177ac16..3b620330 100644 --- a/openapi-generator/templates/java/libraries/microprofile/api_test.mustache +++ b/openapi-generator/templates/java/libraries/microprofile/api_test.mustache @@ -26,7 +26,7 @@ import java.util.Map; * {{{appName}}} Test * {{/appName}} - * API tests for {{classname}} + * API tests for {{classname}} */ {{#generateSpringBootApplication}} @RunWith(SpringJUnit4ClassRunner.class) @@ -38,7 +38,7 @@ public class {{classname}}Test { private {{classname}} client; private String baseUrl = "http://localhost:9080"; - + @Before public void setup() throws MalformedURLException { client = RestClientBuilder.newBuilder() @@ -66,10 +66,10 @@ public class {{classname}}Test { {{#allParams}} {{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}} {{/allParams}} - //{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + //{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); //{{#returnType}}assertNotNull(response);{{/returnType}} - - + + } {{/operation}}{{/operations}} } diff --git a/openapi-generator/templates/java/libraries/microprofile/pojo.mustache b/openapi-generator/templates/java/libraries/microprofile/pojo.mustache index 4ded8e94..80f06d5f 100644 --- a/openapi-generator/templates/java/libraries/microprofile/pojo.mustache +++ b/openapi-generator/templates/java/libraries/microprofile/pojo.mustache @@ -39,7 +39,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializ private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} {{/vars}} - + {{#vars}} /** {{#description}} @@ -60,16 +60,16 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializ {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} {{/vendorExtensions.x-extra-annotation}} -{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} {{#isEnum}}{{^isListContainer}}{{^isMapContainer}}public {{dataType}} {{getter}}() { +{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} {{#isEnum}}{{^isArray}}{{^isMap}}public {{dataType}} {{getter}}() { if ({{name}} == null) { return null; } return {{name}}.value(); - }{{/isMapContainer}}{{/isListContainer}}{{/isEnum}}{{#isEnum}}{{#isListContainer}}public {{{datatypeWithEnum}}} {{getter}}() { + }{{/isMap}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{#isArray}}public {{{datatypeWithEnum}}} {{getter}}() { return {{name}}; - }{{/isListContainer}}{{/isEnum}}{{#isEnum}}{{#isMapContainer}}public {{{datatypeWithEnum}}} {{getter}}() { + }{{/isArray}}{{/isEnum}}{{#isEnum}}{{#isMap}}public {{{datatypeWithEnum}}} {{getter}}() { return {{name}}; - }{{/isMapContainer}}{{/isEnum}}{{^isEnum}}public {{{datatypeWithEnum}}} {{getter}}() { + }{{/isMap}}{{/isEnum}}{{^isEnum}}public {{{datatypeWithEnum}}} {{getter}}() { return {{name}}; }{{/isEnum}} @@ -85,20 +85,20 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializ this.{{name}} = {{name}}; return this; } - {{#isListContainer}} + {{#isArray}} public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { this.{{name}}.add({{name}}Item); return this; } - {{/isListContainer}} - {{#isMapContainer}} + {{/isArray}} + {{#isMap}} public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { this.{{name}}.put(key, {{name}}Item); return this; } - {{/isMapContainer}} + {{/isMap}} {{/isReadOnly}} {{/vars}} diff --git a/openapi-generator/templates/java/libraries/native/api.mustache b/openapi-generator/templates/java/libraries/native/api.mustache index 7d6ed2d4..3ce42c84 100644 --- a/openapi-generator/templates/java/libraries/native/api.mustache +++ b/openapi-generator/templates/java/libraries/native/api.mustache @@ -41,7 +41,7 @@ public class {{classname}} { private final Consumer memberVarInterceptor; private final Duration memberVarReadTimeout; private final Consumer> memberVarResponseInterceptor; - + public {{classname}}() { this(new ApiClient()); } @@ -77,7 +77,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { + public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { {{#allParams}} {{#required}} // verify the required parameter '{{paramName}}' is set @@ -158,7 +158,7 @@ public class {{classname}} { HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); - } + } if (localVarResponse.statusCode()/ 100 != 2) { throw new ApiException(localVarResponse.statusCode(), "{{operationId}} call received non-success response", diff --git a/openapi-generator/templates/java/libraries/okhttp-gson/api.mustache b/openapi-generator/templates/java/libraries/okhttp-gson/api.mustache index 98bcd3d4..bbbca63b 100644 --- a/openapi-generator/templates/java/libraries/okhttp-gson/api.mustache +++ b/openapi-generator/templates/java/libraries/okhttp-gson/api.mustache @@ -126,7 +126,7 @@ public class {{classname}} { {{/formParams}} final String[] localVarAccepts = { - {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -134,12 +134,12 @@ public class {{classname}} { } final String[] localVarContentTypes = { - {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} }; + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; return localVarApiClient.buildCall(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -165,8 +165,8 @@ public class {{classname}} { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); ExecutableValidator executableValidator = factory.getValidator().forExecutables(); - Object[] parameterValues = { {{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}} }; - Method method = this.getClass().getMethod("{{operationId}}WithHttpInfo"{{#allParams}}, {{#isListContainer}}java.util.List{{/isListContainer}}{{#isMapContainer}}java.util.Map{{/isMapContainer}}{{^isListContainer}}{{^isMapContainer}}{{{dataType}}}{{/isMapContainer}}{{/isListContainer}}.class{{/allParams}}); + Object[] parameterValues = { {{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }; + Method method = this.getClass().getMethod("{{operationId}}WithHttpInfo"{{#allParams}}, {{#isArray}}java.util.List{{/isArray}}{{#isMap}}java.util.Map{{/isMap}}{{^isArray}}{{^isMap}}{{{dataType}}}{{/isMap}}{{/isArray}}.class{{/allParams}}); Set> violations = executableValidator.validateParameters(this, method, parameterValues); @@ -215,8 +215,8 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { - {{#returnType}}ApiResponse<{{{returnType}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#returnType}}ApiResponse<{{{returnType}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} return localVarResp.getData();{{/returnType}} } {{/vendorExtensions.x-group-parameters}} @@ -247,7 +247,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType);{{/returnType}}{{^returnType}}return localVarApiClient.execute(localVarCall);{{/returnType}} @@ -297,7 +297,7 @@ public class {{classname}} { private {{{dataType}}} {{paramName}}; {{/optionalParams}} - private API{{operationId}}Request({{#requiredParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}) { + private API{{operationId}}Request({{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) { {{#requiredParams}} this.{{paramName}} = {{paramName}}; {{/requiredParams}} @@ -361,7 +361,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} execute() throws ApiException { - {{#returnType}}ApiResponse<{{{returnType}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + {{#returnType}}ApiResponse<{{{returnType}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} return localVarResp.getData();{{/returnType}} } @@ -386,7 +386,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException { - return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); } /** @@ -440,8 +440,8 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public API{{operationId}}Request {{operationId}}({{#requiredParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}) { - return new API{{operationId}}Request({{#requiredParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}); + public API{{operationId}}Request {{operationId}}({{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) { + return new API{{operationId}}Request({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}); } {{/vendorExtensions.x-group-parameters}} {{/operation}} diff --git a/openapi-generator/templates/java/libraries/okhttp-gson/api_doc.mustache b/openapi-generator/templates/java/libraries/okhttp-gson/api_doc.mustache index c7ce067c..33208866 100644 --- a/openapi-generator/templates/java/libraries/okhttp-gson/api_doc.mustache +++ b/openapi-generator/templates/java/libraries/okhttp-gson/api_doc.mustache @@ -12,8 +12,8 @@ Method | HTTP request | Description {{#operation}} # **{{operationId}}**{{^vendorExtensions.x-group-parameters}} -> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}} -> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#requiredParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}){{#optionalParams}}.{{paramName}}({{paramName}}){{/optionalParams}}.execute();{{/vendorExtensions.x-group-parameters}} +> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}){{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}} +> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}}.{{paramName}}({{paramName}}){{/optionalParams}}.execute();{{/vendorExtensions.x-group-parameters}} {{summary}}{{#notes}} @@ -58,7 +58,7 @@ public class Example { {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} {{/allParams}} try { - {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}){{#optionalParams}} + {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} .{{{paramName}}}({{{paramName}}}){{/optionalParams}} .execute();{{/vendorExtensions.x-group-parameters}}{{#returnType}} System.out.println(result);{{/returnType}} @@ -90,8 +90,8 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} - - **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} + - **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} {{#responses.0}} ### HTTP response details diff --git a/openapi-generator/templates/java/libraries/okhttp-gson/api_test.mustache b/openapi-generator/templates/java/libraries/okhttp-gson/api_test.mustache index b5693776..050bf861 100644 --- a/openapi-generator/templates/java/libraries/okhttp-gson/api_test.mustache +++ b/openapi-generator/templates/java/libraries/okhttp-gson/api_test.mustache @@ -37,7 +37,7 @@ public class {{classname}}Test { {{#allParams}} {{{dataType}}} {{paramName}} = null; {{/allParams}} - {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}){{#optionalParams}} + {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} .{{paramName}}({{paramName}}){{/optionalParams}} .execute();{{/vendorExtensions.x-group-parameters}} diff --git a/openapi-generator/templates/java/libraries/rest-assured/api.mustache b/openapi-generator/templates/java/libraries/rest-assured/api.mustache index 2016726a..dea12171 100644 --- a/openapi-generator/templates/java/libraries/rest-assured/api.mustache +++ b/openapi-generator/templates/java/libraries/rest-assured/api.mustache @@ -73,7 +73,7 @@ public class {{classname}} { nickname = "{{{operationId}}}", tags = { {{#tags}}{{#name}}"{{{name}}}"{{/name}}{{^-last}}, {{/-last}}{{/tags}} }) @ApiResponses(value = { {{#responses}} - @ApiResponse(code = {{{code}}}, message = "{{{message}}}") {{#hasMore}},{{/hasMore}}{{/responses}} }) + @ApiResponse(code = {{{code}}}, message = "{{{message}}}") {{^-last}},{{/-last}}{{/responses}} }) {{#isDeprecated}} @Deprecated {{/isDeprecated}} diff --git a/openapi-generator/templates/java/libraries/rest-assured/api_doc.mustache b/openapi-generator/templates/java/libraries/rest-assured/api_doc.mustache index c8bf2031..f173a890 100644 --- a/openapi-generator/templates/java/libraries/rest-assured/api_doc.mustache +++ b/openapi-generator/templates/java/libraries/rest-assured/api_doc.mustache @@ -12,7 +12,7 @@ Method | HTTP request | Description {{#operation}} # **{{operationId}}** -> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) +> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) {{summary}}{{#notes}} @@ -55,8 +55,8 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} - - **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} + - **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} {{/operation}} {{/operations}} diff --git a/openapi-generator/templates/java/libraries/resteasy/api.mustache b/openapi-generator/templates/java/libraries/resteasy/api.mustache index fcb2268a..85891614 100644 --- a/openapi-generator/templates/java/libraries/resteasy/api.mustache +++ b/openapi-generator/templates/java/libraries/resteasy/api.mustache @@ -56,7 +56,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set @@ -91,16 +91,16 @@ public class {{classname}} { {{/formParams}} final String[] localVarAccepts = { - {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} }; + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; {{#returnType}} GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {}; diff --git a/openapi-generator/templates/java/libraries/resttemplate/api.mustache b/openapi-generator/templates/java/libraries/resttemplate/api.mustache index dc6d434c..09893e99 100644 --- a/openapi-generator/templates/java/libraries/resttemplate/api.mustache +++ b/openapi-generator/templates/java/libraries/resttemplate/api.mustache @@ -72,12 +72,12 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws RestClientException { + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws RestClientException { {{#returnType}} - return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}).getBody(); + return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).getBody(); {{/returnType}} {{^returnType}} - {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); {{/returnType}} } @@ -100,7 +100,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public ResponseEntity<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws RestClientException { + public ResponseEntity<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws RestClientException { Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set @@ -118,31 +118,31 @@ public class {{classname}} { final MultiValueMap cookieParams = new LinkedMultiValueMap(); final MultiValueMap formParams = new LinkedMultiValueMap();{{#hasQueryParams}} - {{#queryParams}}queryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{collectionFormat}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}}));{{#hasMore}} - {{/hasMore}}{{/queryParams}}{{/hasQueryParams}}{{#hasHeaderParams}} + {{#queryParams}}queryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{collectionFormat}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}}));{{^-last}} + {{/-last}}{{/queryParams}}{{/hasQueryParams}}{{#hasHeaderParams}} {{#headerParams}}if ({{paramName}} != null) - headerParams.add("{{baseName}}", apiClient.parameterToString({{paramName}}));{{#hasMore}} - {{/hasMore}}{{/headerParams}}{{/hasHeaderParams}}{{#hasCookieParams}} + headerParams.add("{{baseName}}", apiClient.parameterToString({{paramName}}));{{^-last}} + {{/-last}}{{/headerParams}}{{/hasHeaderParams}}{{#hasCookieParams}} {{#cookieParams}}if ({{paramName}} != null) - cookieParams.add("{{baseName}}", apiClient.parameterToString({{paramName}}));{{#hasMore}} - {{/hasMore}}{{/cookieParams}}{{/hasCookieParams}}{{#hasFormParams}} + cookieParams.add("{{baseName}}", apiClient.parameterToString({{paramName}}));{{^-last}} + {{/-last}}{{/cookieParams}}{{/hasCookieParams}}{{#hasFormParams}} {{#formParams}}if ({{paramName}} != null) - formParams.{{^collectionFormat}}add{{/collectionFormat}}{{#collectionFormat}}put{{/collectionFormat}}("{{baseName}}", {{#isFile}}new FileSystemResource({{paramName}}){{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});{{#hasMore}} - {{/hasMore}}{{/formParams}}{{/hasFormParams}} + formParams.{{^collectionFormat}}add{{/collectionFormat}}{{#collectionFormat}}put{{/collectionFormat}}("{{baseName}}", {{#isFile}}new FileSystemResource({{paramName}}){{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});{{^-last}} + {{/-last}}{{/formParams}}{{/hasFormParams}} final String[] accepts = { {{#hasProduces}} - {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} {{/hasProduces}}}; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { {{#hasConsumes}} - {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} {{/hasConsumes}}}; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); - String[] authNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} }; + String[] authNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; {{#returnType}}ParameterizedTypeReference<{{{returnType}}}> returnType = new ParameterizedTypeReference<{{{returnType}}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference returnType = new ParameterizedTypeReference() {};{{/returnType}} return apiClient.invokeAPI(path, HttpMethod.{{httpMethod}}, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType); diff --git a/openapi-generator/templates/java/libraries/resttemplate/api_test.mustache b/openapi-generator/templates/java/libraries/resttemplate/api_test.mustache index 127ac2de..4ed6dc5b 100644 --- a/openapi-generator/templates/java/libraries/resttemplate/api_test.mustache +++ b/openapi-generator/templates/java/libraries/resttemplate/api_test.mustache @@ -36,7 +36,7 @@ public class {{classname}}Test { {{#allParams}} {{{dataType}}} {{paramName}} = null; {{/allParams}} - {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); // TODO: test validations } diff --git a/openapi-generator/templates/java/libraries/retrofit/ApiClient.mustache b/openapi-generator/templates/java/libraries/retrofit/ApiClient.mustache index a4a99fea..ad3057e9 100644 --- a/openapi-generator/templates/java/libraries/retrofit/ApiClient.mustache +++ b/openapi-generator/templates/java/libraries/retrofit/ApiClient.mustache @@ -73,7 +73,7 @@ public class ApiClient { auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"); {{/isApiKey}} {{#isOAuth}} - auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}"); + auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}"); {{/isOAuth}} } else {{/authMethods}}{ throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); diff --git a/openapi-generator/templates/java/libraries/retrofit/api.mustache b/openapi-generator/templates/java/libraries/retrofit/api.mustache index 9effc056..99b7f4f7 100644 --- a/openapi-generator/templates/java/libraries/retrofit/api.mustache +++ b/openapi-generator/templates/java/libraries/retrofit/api.mustache @@ -36,8 +36,8 @@ public interface {{classname}} { {{#isMultipart}}@retrofit.http.Multipart{{/isMultipart}}{{^isMultipart}}@retrofit.http.FormUrlEncoded{{/isMultipart}}{{/-first}}{{/formParams}} @{{httpMethod}}("{{{path}}}") {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}} {{operationId}}({{^allParams}});{{/allParams}} - {{#allParams}}{{>libraries/retrofit/queryParams}}{{>libraries/retrofit/pathParams}}{{>libraries/retrofit/headerParams}}{{>libraries/retrofit/bodyParams}}{{>libraries/retrofit/formParams}}{{#hasMore}}, {{/hasMore}}{{^hasMore}} - );{{/hasMore}}{{/allParams}} + {{#allParams}}{{>libraries/retrofit/queryParams}}{{>libraries/retrofit/pathParams}}{{>libraries/retrofit/headerParams}}{{>libraries/retrofit/bodyParams}}{{>libraries/retrofit/formParams}}{{^-last}}, {{/-last}}{{#-last}} + );{{/-last}}{{/allParams}} /** * {{summary}} diff --git a/openapi-generator/templates/java/libraries/retrofit/api_test.mustache b/openapi-generator/templates/java/libraries/retrofit/api_test.mustache index a34cfe0e..db07fb82 100644 --- a/openapi-generator/templates/java/libraries/retrofit/api_test.mustache +++ b/openapi-generator/templates/java/libraries/retrofit/api_test.mustache @@ -36,7 +36,7 @@ public class {{classname}}Test { {{#allParams}} {{{dataType}}} {{paramName}} = null; {{/allParams}} - // {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + // {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); // TODO: test validations } diff --git a/openapi-generator/templates/java/libraries/retrofit2/ApiClient.mustache b/openapi-generator/templates/java/libraries/retrofit2/ApiClient.mustache index 88f0a670..e6116a60 100644 --- a/openapi-generator/templates/java/libraries/retrofit2/ApiClient.mustache +++ b/openapi-generator/templates/java/libraries/retrofit2/ApiClient.mustache @@ -74,7 +74,7 @@ public class ApiClient { auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"); {{/isApiKey}} {{#isOAuth}} - auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}"); + auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}"); {{/isOAuth}} } else {{/authMethods}}{ throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); diff --git a/openapi-generator/templates/java/libraries/retrofit2/api.mustache b/openapi-generator/templates/java/libraries/retrofit2/api.mustache index 44f33a51..4ba65287 100644 --- a/openapi-generator/templates/java/libraries/retrofit2/api.mustache +++ b/openapi-generator/templates/java/libraries/retrofit2/api.mustache @@ -69,8 +69,8 @@ public interface {{classname}} { {{/formParams}} @{{httpMethod}}("{{{path}}}") {{^doNotUseRx}}{{#useRxJava}}Observable<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}{{/isResponseFile}}>{{/useRxJava}}{{#useRxJava2}}{{#returnType}}Observable<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}>{{/returnType}}{{^returnType}}Completable{{/returnType}}{{/useRxJava2}}{{/doNotUseRx}}{{#doNotUseRx}}Call<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}{{/isResponseFile}}>{{/doNotUseRx}} {{operationId}}({{^allParams}});{{/allParams}} - {{#allParams}}{{>libraries/retrofit2/queryParams}}{{>libraries/retrofit2/pathParams}}{{>libraries/retrofit2/headerParams}}{{>libraries/retrofit2/bodyParams}}{{>libraries/retrofit2/formParams}}{{#hasMore}}, {{/hasMore}}{{^hasMore}} - );{{/hasMore}}{{/allParams}} + {{#allParams}}{{>libraries/retrofit2/queryParams}}{{>libraries/retrofit2/pathParams}}{{>libraries/retrofit2/headerParams}}{{>libraries/retrofit2/bodyParams}}{{>libraries/retrofit2/formParams}}{{^-last}}, {{/-last}}{{#-last}} + );{{/-last}}{{/allParams}} {{/operation}} } diff --git a/openapi-generator/templates/java/libraries/retrofit2/api_test.mustache b/openapi-generator/templates/java/libraries/retrofit2/api_test.mustache index 0a85ef50..d214d977 100644 --- a/openapi-generator/templates/java/libraries/retrofit2/api_test.mustache +++ b/openapi-generator/templates/java/libraries/retrofit2/api_test.mustache @@ -37,7 +37,7 @@ public class {{classname}}Test { {{#allParams}} {{{dataType}}} {{paramName}} = null; {{/allParams}} - // {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + // {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); // TODO: test validations } diff --git a/openapi-generator/templates/java/libraries/retrofit2/play24/api.mustache b/openapi-generator/templates/java/libraries/retrofit2/play24/api.mustache index dd6bf23e..42cc9347 100644 --- a/openapi-generator/templates/java/libraries/retrofit2/play24/api.mustache +++ b/openapi-generator/templates/java/libraries/retrofit2/play24/api.mustache @@ -51,8 +51,8 @@ public interface {{classname}} { {{/formParams}} @{{httpMethod}}("{{{path}}}") F.Promise> {{operationId}}({{^allParams}});{{/allParams}} - {{#allParams}}{{>libraries/retrofit2/queryParams}}{{>libraries/retrofit2/pathParams}}{{>libraries/retrofit2/headerParams}}{{>libraries/retrofit2/bodyParams}}{{>libraries/retrofit2/formParams}}{{#hasMore}}, {{/hasMore}}{{^hasMore}} - );{{/hasMore}}{{/allParams}} + {{#allParams}}{{>libraries/retrofit2/queryParams}}{{>libraries/retrofit2/pathParams}}{{>libraries/retrofit2/headerParams}}{{>libraries/retrofit2/bodyParams}}{{>libraries/retrofit2/formParams}}{{^-last}}, {{/-last}}{{#-last}} + );{{/-last}}{{/allParams}} {{/operation}} } diff --git a/openapi-generator/templates/java/libraries/retrofit2/play25/api.mustache b/openapi-generator/templates/java/libraries/retrofit2/play25/api.mustache index b435a16c..8f9dc16c 100644 --- a/openapi-generator/templates/java/libraries/retrofit2/play25/api.mustache +++ b/openapi-generator/templates/java/libraries/retrofit2/play25/api.mustache @@ -51,8 +51,8 @@ public interface {{classname}} { {{/formParams}} @{{httpMethod}}("{{{path}}}") CompletionStage> {{operationId}}({{^allParams}});{{/allParams}} - {{#allParams}}{{>libraries/retrofit2/queryParams}}{{>libraries/retrofit2/pathParams}}{{>libraries/retrofit2/headerParams}}{{>libraries/retrofit2/bodyParams}}{{>libraries/retrofit2/formParams}}{{#hasMore}}, {{/hasMore}}{{^hasMore}} - );{{/hasMore}}{{/allParams}} + {{#allParams}}{{>libraries/retrofit2/queryParams}}{{>libraries/retrofit2/pathParams}}{{>libraries/retrofit2/headerParams}}{{>libraries/retrofit2/bodyParams}}{{>libraries/retrofit2/formParams}}{{^-last}}, {{/-last}}{{#-last}} + );{{/-last}}{{/allParams}} {{/operation}} } diff --git a/openapi-generator/templates/java/libraries/retrofit2/play26/api.mustache b/openapi-generator/templates/java/libraries/retrofit2/play26/api.mustache index b435a16c..8f9dc16c 100644 --- a/openapi-generator/templates/java/libraries/retrofit2/play26/api.mustache +++ b/openapi-generator/templates/java/libraries/retrofit2/play26/api.mustache @@ -51,8 +51,8 @@ public interface {{classname}} { {{/formParams}} @{{httpMethod}}("{{{path}}}") CompletionStage> {{operationId}}({{^allParams}});{{/allParams}} - {{#allParams}}{{>libraries/retrofit2/queryParams}}{{>libraries/retrofit2/pathParams}}{{>libraries/retrofit2/headerParams}}{{>libraries/retrofit2/bodyParams}}{{>libraries/retrofit2/formParams}}{{#hasMore}}, {{/hasMore}}{{^hasMore}} - );{{/hasMore}}{{/allParams}} + {{#allParams}}{{>libraries/retrofit2/queryParams}}{{>libraries/retrofit2/pathParams}}{{>libraries/retrofit2/headerParams}}{{>libraries/retrofit2/bodyParams}}{{>libraries/retrofit2/formParams}}{{^-last}}, {{/-last}}{{#-last}} + );{{/-last}}{{/allParams}} {{/operation}} } diff --git a/openapi-generator/templates/java/libraries/vertx/apiImpl.mustache b/openapi-generator/templates/java/libraries/vertx/apiImpl.mustache index 5ea569f4..62ef5eda 100644 --- a/openapi-generator/templates/java/libraries/vertx/apiImpl.mustache +++ b/openapi-generator/templates/java/libraries/vertx/apiImpl.mustache @@ -84,9 +84,9 @@ public class {{classname}}Impl implements {{classname}} { {{#formParams}}if ({{paramName}} != null) localVarFormParams.put("{{baseName}}", {{paramName}}); {{/formParams}} - String[] localVarAccepts = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }; - String[] localVarContentTypes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }; - String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} }; + String[] localVarAccepts = { {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }; + String[] localVarContentTypes = { {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }; + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; {{#returnType}} TypeReference<{{{returnType}}}> localVarReturnType = new TypeReference<{{{returnType}}}>() {}; apiClient.invokeAPI(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, localVarReturnType, resultHandler);{{/returnType}}{{^returnType}} diff --git a/openapi-generator/templates/java/libraries/vertx/rxApiImpl.mustache b/openapi-generator/templates/java/libraries/vertx/rxApiImpl.mustache index be144ff3..2093e622 100644 --- a/openapi-generator/templates/java/libraries/vertx/rxApiImpl.mustache +++ b/openapi-generator/templates/java/libraries/vertx/rxApiImpl.mustache @@ -44,7 +44,7 @@ public class {{classname}} { {{/allParams}} * @return Asynchronous result handler (RxJava Single) */ - public Single<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> rx{{operationIdCamelCase}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { + public Single<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> rx{{operationIdCamelCase}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { delegate.{{operationId}}({{#allParams}}{{paramName}}, {{/allParams}}fut); })); diff --git a/openapi-generator/templates/java/libraries/webclient/api.mustache b/openapi-generator/templates/java/libraries/webclient/api.mustache index b852e87e..f41b90f0 100644 --- a/openapi-generator/templates/java/libraries/webclient/api.mustache +++ b/openapi-generator/templates/java/libraries/webclient/api.mustache @@ -62,7 +62,7 @@ public class {{classname}} { * @see {{summary}} Documentation {{/externalDocs}} */ - public {{#returnType}}{{#isListContainer}}Flux<{{{returnBaseType}}}>{{/isListContainer}}{{^isListContainer}}Mono<{{{returnType}}}>{{/isListContainer}} {{/returnType}}{{^returnType}}Mono {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws RestClientException { + public {{#returnType}}{{#isArray}}Flux<{{{returnBaseType}}}>{{/isArray}}{{^isArray}}Mono<{{{returnType}}}>{{/isArray}} {{/returnType}}{{^returnType}}Mono {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws RestClientException { Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; {{#allParams}} {{#required}} @@ -95,8 +95,8 @@ public class {{classname}} { {{#headerParams}} if ({{paramName}} != null) - headerParams.add("{{baseName}}", apiClient.parameterToString({{paramName}}));{{#hasMore}} - {{/hasMore}} + headerParams.add("{{baseName}}", apiClient.parameterToString({{paramName}}));{{^-last}} + {{/-last}} {{/headerParams}} {{/hasHeaderParams}} {{#hasCookieParams}} @@ -114,18 +114,18 @@ public class {{classname}} { {{/hasFormParams}} final String[] localVarAccepts = { {{#hasProduces}} - {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} {{/hasProduces}}}; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { {{#hasConsumes}} - {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} {{/hasConsumes}}}; final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} }; + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; - {{#returnType}}ParameterizedTypeReference<{{#isListContainer}}{{{returnBaseType}}}{{/isListContainer}}{{^isListContainer}}{{{returnType}}}{{/isListContainer}}> localVarReturnType = new ParameterizedTypeReference<{{#isListContainer}}{{{returnBaseType}}}{{/isListContainer}}{{^isListContainer}}{{{returnType}}}{{/isListContainer}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};{{/returnType}} - return apiClient.{{#isListContainer}}invokeFluxAPI{{/isListContainer}}{{^isListContainer}}invokeAPI{{/isListContainer}}("{{{path}}}", HttpMethod.{{httpMethod}}, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + {{#returnType}}ParameterizedTypeReference<{{#isArray}}{{{returnBaseType}}}{{/isArray}}{{^isArray}}{{{returnType}}}{{/isArray}}> localVarReturnType = new ParameterizedTypeReference<{{#isArray}}{{{returnBaseType}}}{{/isArray}}{{^isArray}}{{{returnType}}}{{/isArray}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};{{/returnType}} + return apiClient.{{#isArray}}invokeFluxAPI{{/isArray}}{{^isArray}}invokeAPI{{/isArray}}("{{{path}}}", HttpMethod.{{httpMethod}}, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } {{/operation}} } diff --git a/openapi-generator/templates/java/libraries/webclient/api_test.mustache b/openapi-generator/templates/java/libraries/webclient/api_test.mustache index 1b730bf4..301acf8f 100644 --- a/openapi-generator/templates/java/libraries/webclient/api_test.mustache +++ b/openapi-generator/templates/java/libraries/webclient/api_test.mustache @@ -33,7 +33,7 @@ public class {{classname}}Test { {{#allParams}} {{{dataType}}} {{paramName}} = null; {{/allParams}} - {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#isListContainer}}.collectList().block(){{/isListContainer}}{{^isListContainer}}.block(){{/isListContainer}}; + {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{#isArray}}.collectList().block(){{/isArray}}{{^isArray}}.block(){{/isArray}}; // TODO: test validations } diff --git a/openapi-generator/templates/java/model.mustache b/openapi-generator/templates/java/model.mustache index d4d1447a..f097a959 100644 --- a/openapi-generator/templates/java/model.mustache +++ b/openapi-generator/templates/java/model.mustache @@ -8,7 +8,6 @@ import org.apache.commons.lang3.builder.HashCodeBuilder; {{/useReflectionEqualsHashCode}} {{^supportJava6}} import java.util.Objects; -import java.util.Arrays; {{/supportJava6}} {{#supportJava6}} import org.apache.commons.lang3.ObjectUtils; @@ -39,6 +38,8 @@ import javax.validation.Valid; {{#performBeanValidation}} import org.hibernate.validator.constraints.*; {{/performBeanValidation}} +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; {{#models}} {{#model}} diff --git a/openapi-generator/templates/java/pojo.mustache b/openapi-generator/templates/java/pojo.mustache index 653f4406..20f18dab 100644 --- a/openapi-generator/templates/java/pojo.mustache +++ b/openapi-generator/templates/java/pojo.mustache @@ -1,16 +1,35 @@ /** - * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}} - */{{#description}} -@ApiModel(description = "{{{description}}}"){{/description}} + * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} + * @deprecated{{/isDeprecated}} + */{{#isDeprecated}} +@Deprecated{{/isDeprecated}} +{{#swagger1AnnotationLibrary}} +{{#description}} +@ApiModel(description = "{{{.}}}") +{{/description}} +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} +{{#description}} +@Schema(description = "{{{.}}}") +{{/description}} +{{/swagger2AnnotationLibrary}} {{#jackson}} @JsonPropertyOrder({ {{#vars}} {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} {{/vars}} }) +{{#isClassnameSanitized}} +{{^hasDiscriminatorWithNonEmptyMapping}} +@JsonTypeName("{{name}}") +{{/hasDiscriminatorWithNonEmptyMapping}} +{{/isClassnameSanitized}} {{/jackson}} {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} -public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ +{{#vendorExtensions.x-class-extra-annotation}} +{{{vendorExtensions.x-class-extra-annotation}}} +{{/vendorExtensions.x-class-extra-annotation}} +public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ {{#serializableModel}} private static final long serialVersionUID = 1L; @@ -34,28 +53,34 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE {{/jackson}} {{#withXml}} {{#isXmlAttribute}} - @XmlAttribute(name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + @XmlAttribute(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") {{/isXmlAttribute}} {{^isXmlAttribute}} {{^isContainer}} - @XmlElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") {{/isContainer}} {{#isContainer}} // Is a container wrapped={{isXmlWrapped}} {{#items}} // items.name={{name}} items.baseName={{baseName}} items.xmlName={{xmlName}} items.xmlNamespace={{xmlNamespace}} // items.example={{example}} items.type={{dataType}} - @XmlElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") {{/items}} {{#isXmlWrapped}} - @XmlElementWrapper({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + @XmlElementWrapper({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") {{/isXmlWrapped}} {{/isContainer}} + {{#isDateTime}} + @XmlJavaTypeAdapter(OffsetDateTimeXmlAdapter.class) + {{/isDateTime}} {{/isXmlAttribute}} {{/withXml}} {{#gson}} @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) {{/gson}} + {{#vendorExtensions.x-field-extra-annotation}} + {{{vendorExtensions.x-field-extra-annotation}}} + {{/vendorExtensions.x-field-extra-annotation}} {{#vendorExtensions.x-is-jackson-optional-nullable}} {{#isContainer}} private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); @@ -66,7 +91,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE {{/vendorExtensions.x-is-jackson-optional-nullable}} {{^vendorExtensions.x-is-jackson-optional-nullable}} {{#isContainer}} - private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}}; + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} {{^isContainer}} {{#isDiscriminator}}protected{{/isDiscriminator}}{{^isDiscriminator}}private{{/isDiscriminator}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; @@ -74,27 +99,35 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE {{/vendorExtensions.x-is-jackson-optional-nullable}} {{/vars}} - {{#parcelableModel}} public {{classname}}() { - {{#parent}} - super(); - {{/parent}} - {{#gson}} - {{#discriminator}} + {{#parent}} + {{#parcelableModel}} + super();{{/parcelableModel}} + {{/parent}} + {{#gson}} + {{#discriminator}} + {{#discriminator.isEnum}} this.{{{discriminatorName}}} = this.getClass().getSimpleName(); - {{/discriminator}} - {{/gson}} + {{/discriminator.isEnum}} + {{/discriminator}} + {{/gson}} } - {{/parcelableModel}} - {{^parcelableModel}} - {{#gson}} - {{#discriminator}} - public {{classname}}() { - this.{{{discriminatorName}}} = this.getClass().getSimpleName(); + {{#vendorExtensions.x-has-readonly-properties}} + {{^withXml}} + + {{#jsonb}}@JsonbCreator{{/jsonb}}{{#jackson}}@JsonCreator{{/jackson}} + public {{classname}}( + {{#readOnlyVars}} + {{#jsonb}}@JsonbProperty(value = "{{baseName}}"{{^required}}, nullable = true{{/required}}){{/jsonb}}{{#jackson}}@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} + {{/readOnlyVars}} + ) { + this(); + {{#readOnlyVars}} + this.{{name}} = {{#vendorExtensions.x-is-jackson-optional-nullable}}{{name}} == null ? JsonNullable.<{{{datatypeWithEnum}}}>undefined() : JsonNullable.of({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{name}}{{/vendorExtensions.x-is-jackson-optional-nullable}}; + {{/readOnlyVars}} } - {{/discriminator}} - {{/gson}} - {{/parcelableModel}} + {{/withXml}} + {{/vendorExtensions.x-has-readonly-properties}} {{#vars}} {{^isReadOnly}} @@ -103,12 +136,12 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE {{^vendorExtensions.x-is-jackson-optional-nullable}}this.{{name}} = {{name}};{{/vendorExtensions.x-is-jackson-optional-nullable}} return this; } - {{#isListContainer}} + {{#isArray}} public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} if (this.{{name}} == null || !this.{{name}}.isPresent()) { - this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}); } try { this.{{name}}.get().add({{name}}Item); @@ -118,22 +151,20 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} {{^vendorExtensions.x-is-jackson-optional-nullable}} - {{^required}} if (this.{{name}} == null) { - this.{{name}} = {{{defaultValue}}}; + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}; } - {{/required}} this.{{name}}.add({{name}}Item); return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} } - {{/isListContainer}} - {{#isMapContainer}} + {{/isArray}} + {{#isMap}} public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} if (this.{{name}} == null || !this.{{name}}.isPresent()) { - this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}); } try { this.{{name}}.get().put(key, {{name}}Item); @@ -145,40 +176,60 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE {{^vendorExtensions.x-is-jackson-optional-nullable}} {{^required}} if (this.{{name}} == null) { - this.{{name}} = {{{defaultValue}}}; + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}; } {{/required}} this.{{name}}.put(key, {{name}}Item); return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} } - {{/isMapContainer}} + {{/isMap}} {{/isReadOnly}} /** {{#description}} - * {{description}} + * {{.}} {{/description}} {{^description}} * Get {{name}} {{/description}} {{#minimum}} - * minimum: {{minimum}} + * minimum: {{.}} {{/minimum}} {{#maximum}} - * maximum: {{maximum}} + * maximum: {{.}} {{/maximum}} * @return {{name}} + {{#deprecated}} + * @deprecated + {{/deprecated}} **/ +{{#deprecated}} + @Deprecated +{{/deprecated}} {{#required}} {{#isNullable}} - @javax.annotation.Nullable + @{{javaxPackage}}.annotation.Nullable +{{/isNullable}} +{{^isNullable}} + @{{javaxPackage}}.annotation.Nonnull {{/isNullable}} {{/required}} {{^required}} - @javax.annotation.Nullable + @{{javaxPackage}}.annotation.Nullable {{/required}} -{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{#jsonb}} + @JsonbProperty("{{baseName}}") +{{/jsonb}} +{{#useBeanValidation}} +{{>beanValidation}} +{{/useBeanValidation}} +{{#swagger1AnnotationLibrary}} + @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") +{{/swagger2AnnotationLibrary}} {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} {{/vendorExtensions.x-extra-annotation}} @@ -215,7 +266,8 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE {{/vendorExtensions.x-is-jackson-optional-nullable}} {{^isReadOnly}} - public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { +{{#vendorExtensions.x-setter-extra-annotation}} {{{vendorExtensions.x-setter-extra-annotation}}} +{{/vendorExtensions.x-setter-extra-annotation}}{{#jackson}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{> jackson_annotations}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{/jackson}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { {{#vendorExtensions.x-is-jackson-optional-nullable}} this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); {{/vendorExtensions.x-is-jackson-optional-nullable}} @@ -226,10 +278,25 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE {{/isReadOnly}} {{/vars}} + {{#parent}} + {{#allVars}} + {{#isOverridden}} + @Override + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.{{setter}}(JsonNullable.<{{{datatypeWithEnum}}}>of({{name}})); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.{{setter}}({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + return this; + } -{{^supportJava6}} + {{/isOverridden}} + {{/allVars}} + {{/parent}} @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { {{#useReflectionEqualsHashCode}} return EqualsBuilder.reflectionEquals(this, o, false, null, true); {{/useReflectionEqualsHashCode}} @@ -241,12 +308,16 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE return false; }{{#hasVars}} {{classname}} {{classVarName}} = ({{classname}}) o; - return {{#vars}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} && - {{/hasMore}}{{/vars}}{{#parent}} && + return {{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}equalsNullable(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}} && + {{/-last}}{{/vars}}{{#parent}} && super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}} {{/useReflectionEqualsHashCode}} - } + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} @Override public int hashCode() { @@ -254,33 +325,16 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE return HashCodeBuilder.reflectionHashCode(this); {{/useReflectionEqualsHashCode}} {{^useReflectionEqualsHashCode}} - return Objects.hash({{#vars}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); + return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); {{/useReflectionEqualsHashCode}} - } + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} -{{/supportJava6}} -{{#supportJava6}} - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - }{{#hasVars}} - {{classname}} {{classVarName}} = ({{classname}}) o; - return {{#vars}}ObjectUtils.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} && - {{/hasMore}}{{/vars}}{{#parent}} && - super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} - return true;{{/hasVars}} - } - - @Override - public int hashCode() { - return ObjectUtils.hashCodeMulti({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); - } - -{{/supportJava6}} + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} @Override public String toString() { @@ -300,36 +354,229 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(java.lang.Object o) { + private{{#jsonb}} static{{/jsonb}} String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } +{{#supportUrlQuery}} + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + StringJoiner joiner = new StringJoiner("&"); + + {{#allVars}} + // add `{{baseName}}` to the URL query string + {{#isArray}} + {{#items.isPrimitiveType}} + {{#uniqueItems}} + if ({{getter}}() != null) { + int i = 0; + for ({{{items.dataType}}} _item : {{getter}}()) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if ({{getter}}() != null) { + for (int i = 0; i < {{getter}}().size(); i++) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + {{/uniqueItems}} + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + {{#items.isModel}} + {{#uniqueItems}} + if ({{getter}}() != null) { + int i = 0; + for ({{{items.dataType}}} _item : {{getter}}()) { + if (_item != null) { + joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if ({{getter}}() != null) { + for (int i = 0; i < {{getter}}().size(); i++) { + if ({{getter}}().get(i) != null) { + joiner.add({{getter}}().get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{^items.isModel}} + {{#uniqueItems}} + if ({{getter}}() != null) { + int i = 0; + for ({{{items.dataType}}} _item : {{getter}}()) { + if (_item != null) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + i++; + } + } + {{/uniqueItems}} + {{^uniqueItems}} + if ({{getter}}() != null) { + for (int i = 0; i < {{getter}}().size(); i++) { + if ({{getter}}().get(i) != null) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{/items.isPrimitiveType}} + {{/isArray}} + {{^isArray}} + {{#isMap}} + {{^items.isModel}} + if ({{getter}}() != null) { + for (String _key : {{getter}}().keySet()) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix), + {{getter}}().get(_key), URLEncoder.encode(String.valueOf({{getter}}().get(_key)), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + {{/items.isModel}} + {{#items.isModel}} + if ({{getter}}() != null) { + for (String _key : {{getter}}().keySet()) { + if ({{getter}}().get(_key) != null) { + joiner.add({{getter}}().get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix)))); + } + } + } + {{/items.isModel}} + {{/isMap}} + {{^isMap}} + {{#isPrimitiveType}} + if ({{getter}}() != null) { + try { + joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isModel}} + if ({{getter}}() != null) { + joiner.add({{getter}}().toUrlQueryString(prefix + "{{{baseName}}}" + suffix)); + } + {{/isModel}} + {{^isModel}} + if ({{getter}}() != null) { + try { + joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + {{/isModel}} + {{/isPrimitiveType}} + {{/isMap}} + {{/isArray}} + + {{/allVars}} + return joiner.toString(); + } +{{/supportUrlQuery}} {{#parcelableModel}} public void writeToParcel(Parcel out, int flags) { {{#model}} -{{#isArrayModel}} +{{#isArray}} out.writeList(this); -{{/isArrayModel}} -{{^isArrayModel}} +{{/isArray}} +{{^isArray}} {{#parent}} super.writeToParcel(out, flags); {{/parent}} {{#vars}} out.writeValue({{name}}); {{/vars}} -{{/isArrayModel}} +{{/isArray}} {{/model}} } {{classname}}(Parcel in) { -{{#isArrayModel}} +{{#isArray}} in.readTypedList(this, {{arrayModelType}}.CREATOR); -{{/isArrayModel}} -{{^isArrayModel}} +{{/isArray}} +{{^isArray}} {{#parent}} super(in); {{/parent}} @@ -341,7 +588,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE {{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader()); {{/isPrimitiveType}} {{/vars}} -{{/isArrayModel}} +{{/isArray}} } public int describeContents() { @@ -351,14 +598,14 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<{{classname}}>() { public {{classname}} createFromParcel(Parcel in) { {{#model}} -{{#isArrayModel}} +{{#isArray}} {{classname}} result = new {{classname}}(); result.addAll(in.readArrayList({{arrayModelType}}.class.getClassLoader())); return result; -{{/isArrayModel}} -{{^isArrayModel}} +{{/isArray}} +{{^isArray}} return new {{classname}}(in); -{{/isArrayModel}} +{{/isArray}} {{/model}} } public {{classname}}[] newArray(int size) { @@ -366,4 +613,5 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE } }; {{/parcelableModel}} + } diff --git a/openapi-generator/templates/php/ObjectSerializer.mustache b/openapi-generator/templates/php/ObjectSerializer.mustache index c6d80ce1..aa4f3302 100644 --- a/openapi-generator/templates/php/ObjectSerializer.mustache +++ b/openapi-generator/templates/php/ObjectSerializer.mustache @@ -286,9 +286,6 @@ class ObjectSerializer } else { return null; } - } elseif (in_array($class, [{{&primitives}}], true)) { - settype($data, $class); - return $data; } elseif ($class === '\SplFileObject') { /** @var \Psr\Http\Message\StreamInterface $data */ @@ -307,6 +304,9 @@ class ObjectSerializer fclose($file); return new \SplFileObject($filename, 'r'); + } elseif (in_array($class, [{{&primitives}}], true)) { + settype($data, $class); + return $data; } elseif (method_exists($class, 'getAllowableEnumValues')) { if (!in_array($data, $class::getAllowableEnumValues(), true)) { $imploded = implode("', '", $class::getAllowableEnumValues()); diff --git a/openapi-generator/templates/php/README.mustache b/openapi-generator/templates/php/README.mustache index a38f7158..63578ec6 100644 --- a/openapi-generator/templates/php/README.mustache +++ b/openapi-generator/templates/php/README.mustache @@ -84,7 +84,7 @@ $apiInstance = new {{invokerPackage}}\Api\{{classname}}( {{/allParams}} try { - {{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + {{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} print_r($result);{{/returnType}} } catch (Exception $e) { echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL; @@ -93,7 +93,22 @@ try { ?> ``` -{{>../shared/datacenters}} +## Datacenters + +The API is only accessible via HTTPS and the current version is v2, which results in a base URL like: {{{basePath}}} depending on the datacenter. + +### EU Datacenter +``` +{{{basePath}}} +``` + +This is the default datacenter. + +### US Datacenter +``` +https://api.us.app.phrase.com/v2/ +``` + ### Specifying US Datacenter You can use the US datacenter by setting the following: ``` @@ -172,8 +187,8 @@ Class | Method | HTTP request | Description ## Author -{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} -{{/hasMore}}{{/apis}}{{/apiInfo}} +{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} +{{/-last}}{{/apis}}{{/apiInfo}} ## Get help / support diff --git a/openapi-generator/templates/php/api.mustache b/openapi-generator/templates/php/api.mustache index c4dc5e3f..68e6e4c6 100644 --- a/openapi-generator/templates/php/api.mustache +++ b/openapi-generator/templates/php/api.mustache @@ -138,9 +138,9 @@ use {{invokerPackage}}\ObjectSerializer; * @throws \InvalidArgumentException * @return {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}void{{/returnType}} */ - public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { - {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} + {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} return $response;{{/returnType}} } @@ -176,9 +176,9 @@ use {{invokerPackage}}\ObjectSerializer; * @throws \InvalidArgumentException * @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) */ - public function {{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + public function {{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { - $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); + $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); try { $options = $this->createHttpClientOption(); @@ -300,9 +300,9 @@ use {{invokerPackage}}\ObjectSerializer; * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function {{operationId}}Async({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + public function {{operationId}}Async({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { - return $this->{{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + return $this->{{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) ->then( function ($response) { return $response[0]; @@ -339,10 +339,10 @@ use {{invokerPackage}}\ObjectSerializer; * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function {{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + public function {{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { $returnType = '{{returnType}}'; - $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); + $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -406,7 +406,7 @@ use {{invokerPackage}}\ObjectSerializer; * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function {{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + protected function {{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { {{#vendorExtensions.x-group-parameters}} // unbox the parameters from the associative array @@ -550,12 +550,12 @@ use {{invokerPackage}}\ObjectSerializer; if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( - [{{#produces}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/produces}}] + [{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}] ); } else { $headers = $this->headerSelector->selectHeaders( - [{{#produces}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/produces}}], - [{{#consumes}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}] + [{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}], + [{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}] ); } diff --git a/openapi-generator/templates/php/api_doc.mustache b/openapi-generator/templates/php/api_doc.mustache index 87dbbf71..46c7b3de 100644 --- a/openapi-generator/templates/php/api_doc.mustache +++ b/openapi-generator/templates/php/api_doc.mustache @@ -14,7 +14,7 @@ Method | HTTP request | Description ## {{{operationId}}} -> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) +> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) {{{summary}}}{{#notes}} @@ -43,7 +43,7 @@ $apiInstance = new {{invokerPackage}}\Api\{{classname}}( {{/vendorExtensions.x-group-parameters}} try { - {{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associate_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} + {{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associate_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} print_r($result);{{/returnType}} } catch (Exception $e) { echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL; @@ -73,8 +73,8 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} -- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} +- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} +- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) diff --git a/openapi-generator/templates/php/model_generic.mustache b/openapi-generator/templates/php/model_generic.mustache index 8e1e36bd..61b8ae79 100644 --- a/openapi-generator/templates/php/model_generic.mustache +++ b/openapi-generator/templates/php/model_generic.mustache @@ -15,8 +15,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa * @var string[] */ protected static $openAPITypes = [ - {{#vars}}'{{name}}' => '{{{dataType}}}'{{#hasMore}}, - {{/hasMore}}{{/vars}} + {{#vars}}'{{name}}' => '{{{dataType}}}'{{^-last}}, + {{/-last}}{{/vars}} ]; /** @@ -25,8 +25,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa * @var string[] */ protected static $openAPIFormats = [ - {{#vars}}'{{name}}' => {{#dataFormat}}'{{{dataFormat}}}'{{/dataFormat}}{{^dataFormat}}null{{/dataFormat}}{{#hasMore}}, - {{/hasMore}}{{/vars}} + {{#vars}}'{{name}}' => {{#dataFormat}}'{{{dataFormat}}}'{{/dataFormat}}{{^dataFormat}}null{{/dataFormat}}{{^-last}}, + {{/-last}}{{/vars}} ]; /** @@ -56,8 +56,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa * @var string[] */ protected static $attributeMap = [ - {{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}}, - {{/hasMore}}{{/vars}} + {{#vars}}'{{name}}' => '{{baseName}}'{{^-last}}, + {{/-last}}{{/vars}} ]; /** @@ -66,8 +66,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa * @var string[] */ protected static $setters = [ - {{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}}, - {{/hasMore}}{{/vars}} + {{#vars}}'{{name}}' => '{{setter}}'{{^-last}}, + {{/-last}}{{/vars}} ]; /** @@ -76,8 +76,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa * @var string[] */ protected static $getters = [ - {{#vars}}'{{name}}' => '{{getter}}'{{#hasMore}}, - {{/hasMore}}{{/vars}} + {{#vars}}'{{name}}' => '{{getter}}'{{^-last}}, + {{/-last}}{{/vars}} ]; /** diff --git a/openapi-generator/templates/python/api.mustache b/openapi-generator/templates/python/api.mustache index f2c55418..25e85ff9 100644 --- a/openapi-generator/templates/python/api.mustache +++ b/openapi-generator/templates/python/api.mustache @@ -118,7 +118,7 @@ class {{classname}}(object): all_params = [ {{#allParams}} - '{{paramName}}'{{#hasMore}},{{/hasMore}} + '{{paramName}}'{{^-last}},{{/-last}} {{/allParams}} ] all_params.extend( @@ -192,30 +192,30 @@ class {{classname}}(object): path_params = {} {{#pathParams}} if '{{paramName}}' in local_var_params: - path_params['{{baseName}}'] = local_var_params['{{paramName}}']{{#isListContainer}} # noqa: E501 - collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501 + path_params['{{baseName}}'] = local_var_params['{{paramName}}']{{#isArray}} # noqa: E501 + collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isArray}} # noqa: E501 {{/pathParams}} query_params = [] {{#queryParams}} if '{{paramName}}' in local_var_params and local_var_params['{{paramName}}'] is not None: # noqa: E501 - query_params.append(('{{baseName}}', local_var_params['{{paramName}}'])){{#isListContainer}} # noqa: E501 - collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501 + query_params.append(('{{baseName}}', local_var_params['{{paramName}}'])){{#isArray}} # noqa: E501 + collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isArray}} # noqa: E501 {{/queryParams}} header_params = {} {{#headerParams}} if '{{paramName}}' in local_var_params: - header_params['{{baseName}}'] = local_var_params['{{paramName}}']{{#isListContainer}} # noqa: E501 - collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501 + header_params['{{baseName}}'] = local_var_params['{{paramName}}']{{#isArray}} # noqa: E501 + collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isArray}} # noqa: E501 {{/headerParams}} form_params = [] local_var_files = {} {{#formParams}} if '{{paramName}}' in local_var_params: - {{^isFile}}form_params.append(('{{baseName}}', local_var_params['{{paramName}}'])){{/isFile}}{{#isFile}}local_var_files['{{baseName}}'] = local_var_params['{{paramName}}']{{/isFile}}{{#isListContainer}} # noqa: E501 - collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501 + {{^isFile}}form_params.append(('{{baseName}}', local_var_params['{{paramName}}'])){{/isFile}}{{#isFile}}local_var_files['{{baseName}}'] = local_var_params['{{paramName}}']{{/isFile}}{{#isArray}} # noqa: E501 + collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isArray}} # noqa: E501 {{/formParams}} body_params = None @@ -226,17 +226,17 @@ class {{classname}}(object): {{#hasProduces}} # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( - [{{#produces}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/produces}}]) # noqa: E501 + [{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}]) # noqa: E501 {{/hasProduces}} {{#hasConsumes}} # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - [{{#consumes}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}]) # noqa: E501 + [{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}]) # noqa: E501 {{/hasConsumes}} # Authentication setting - auth_settings = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}] # noqa: E501 + auth_settings = [{{#authMethods}}'{{name}}'{{^-last}}, {{/-last}}{{/authMethods}}] # noqa: E501 return self.api_client.call_api( '{{{path}}}', '{{httpMethod}}', diff --git a/openapi-generator/templates/python/api_client.mustache b/openapi-generator/templates/python/api_client.mustache index e07dd1e9..3d6fd61d 100644 --- a/openapi-generator/templates/python/api_client.mustache +++ b/openapi-generator/templates/python/api_client.mustache @@ -271,7 +271,7 @@ class ApiClient(object): """ # handle file downloading # save response body into a tmp file and return the instance - if response_type == "file": + if response_type == "bytearray": return self.__deserialize_file(response) # fetch data from response object @@ -294,13 +294,13 @@ class ApiClient(object): return None if type(klass) == str: - if klass.startswith('list['): - sub_kls = re.match(r'list\[(.*)\]', klass).group(1) + if klass.startswith('List['): + sub_kls = re.match(r'List\[(.*)\]', klass).group(1) return [self.__deserialize(sub_data, sub_kls) for sub_data in data] - if klass.startswith('dict('): - sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) + if klass.startswith('Dict('): + sub_kls = re.match(r'Dict\(([^,]*), (.*)\)', klass).group(2) return {k: self.__deserialize(v, sub_kls) for k, v in six.iteritems(data)} diff --git a/openapi-generator/templates/python/api_doc.mustache b/openapi-generator/templates/python/api_doc.mustache index 5be8a441..f7bd7faa 100644 --- a/openapi-generator/templates/python/api_doc.mustache +++ b/openapi-generator/templates/python/api_doc.mustache @@ -11,7 +11,7 @@ Method | HTTP request | Description {{#operations}} {{#operation}} # **{{{operationId}}}** -> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{/required}}{{^required}}{{{paramName}}}={{{paramName}}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) +> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{/required}}{{^required}}{{{paramName}}}={{{paramName}}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) {{{summary}}}{{#notes}} @@ -38,8 +38,8 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} - - **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} + - **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} {{#responses.0}} ### HTTP response details diff --git a/openapi-generator/templates/python/api_doc_example.mustache b/openapi-generator/templates/python/api_doc_example.mustache index 7e1e309c..e768a955 100644 --- a/openapi-generator/templates/python/api_doc_example.mustache +++ b/openapi-generator/templates/python/api_doc_example.mustache @@ -21,7 +21,7 @@ with {{{packageName}}}.ApiClient() as api_client: try: {{#summary}} # {{{.}}} - {{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}} + {{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}} pprint(api_response){{/returnType}} except ApiException as e: print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) diff --git a/openapi-generator/templates/python/common_README.mustache b/openapi-generator/templates/python/common_README.mustache index 9c03b403..dc73d8b5 100644 --- a/openapi-generator/templates/python/common_README.mustache +++ b/openapi-generator/templates/python/common_README.mustache @@ -18,14 +18,29 @@ with {{{packageName}}}.ApiClient(configuration) as api_client: try: {{#summary}} # {{{.}}} - {{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}} + {{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}} pprint(api_response){{/returnType}} except ApiException as e: print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} ``` -{{>../shared/datacenters}} +## Datacenters + +The API is only accessible via HTTPS and the current version is v2, which results in a base URL like: {{{basePath}}} depending on the datacenter. + +### EU Datacenter +``` +{{{basePath}}} +``` + +This is the default datacenter. + +### US Datacenter +``` +https://api.us.app.phrase.com/v2/ +``` + ### Specifying US Datacenter You can use the US datacenter by setting the following: ``` @@ -111,8 +126,8 @@ Class | Method | HTTP request | Description ## Author -{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} -{{/hasMore}}{{/apis}}{{/apiInfo}} +{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} +{{/-last}}{{/apis}}{{/apiInfo}} ## Get help / support diff --git a/openapi-generator/templates/python/model.mustache b/openapi-generator/templates/python/model.mustache index 70f6e748..86023f90 100644 --- a/openapi-generator/templates/python/model.mustache +++ b/openapi-generator/templates/python/model.mustache @@ -40,13 +40,13 @@ class {{classname}}(object): """ openapi_types = { {{#vars}} - '{{name}}': '{{{dataType}}}'{{#hasMore}},{{/hasMore}} + '{{name}}': '{{{dataType}}}'{{^-last}},{{/-last}} {{/vars}} } attribute_map = { {{#vars}} - '{{name}}': '{{baseName}}'{{#hasMore}},{{/hasMore}} + '{{name}}': '{{baseName}}'{{^-last}},{{/-last}} {{/vars}} } {{#discriminator}} @@ -117,7 +117,7 @@ class {{classname}}(object): {{#isEnum}} {{#isContainer}} allowed_values = [{{#isNullable}}None,{{/isNullable}}{{#allowableValues}}{{#values}}{{#items.isString}}"{{/items.isString}}{{{this}}}{{#items.isString}}"{{/items.isString}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] # noqa: E501 -{{#isListContainer}} +{{#isArray}} if (self.local_vars_configuration.client_side_validation and not set({{{name}}}).issubset(set(allowed_values))): # noqa: E501 raise ValueError( @@ -125,8 +125,8 @@ class {{classname}}(object): .format(", ".join(map(str, set({{{name}}}) - set(allowed_values))), # noqa: E501 ", ".join(map(str, allowed_values))) ) -{{/isListContainer}} -{{#isMapContainer}} +{{/isArray}} +{{#isMap}} if (self.local_vars_configuration.client_side_validation and not set({{{name}}}.keys()).issubset(set(allowed_values))): # noqa: E501 raise ValueError( @@ -134,7 +134,7 @@ class {{classname}}(object): .format(", ".join(map(str, set({{{name}}}.keys()) - set(allowed_values))), # noqa: E501 ", ".join(map(str, allowed_values))) ) -{{/isMapContainer}} +{{/isMap}} {{/isContainer}} {{^isContainer}} allowed_values = [{{#isNullable}}None,{{/isNullable}}{{#allowableValues}}{{#values}}{{#isString}}"{{/isString}}{{{this}}}{{#isString}}"{{/isString}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] # noqa: E501 diff --git a/openapi-generator/templates/python/model_test.mustache b/openapi-generator/templates/python/model_test.mustache index 098d8b08..da0779fc 100644 --- a/openapi-generator/templates/python/model_test.mustache +++ b/openapi-generator/templates/python/model_test.mustache @@ -33,7 +33,7 @@ class Test{{classname}}(unittest.TestCase): if include_optional : return {{classname}}( {{#vars}} - {{name}} = {{#example}}{{{.}}}{{/example}}{{^example}}None{{/example}}{{#hasMore}}, {{/hasMore}} + {{name}} = {{#example}}{{{.}}}{{/example}}{{^example}}None{{/example}}{{^-last}}, {{/-last}} {{/vars}} ) else : diff --git a/openapi-generator/templates/python/python-experimental/README_common.mustache b/openapi-generator/templates/python/python-experimental/README_common.mustache index b474eb26..e633ce2b 100644 --- a/openapi-generator/templates/python/python-experimental/README_common.mustache +++ b/openapi-generator/templates/python/python-experimental/README_common.mustache @@ -16,7 +16,7 @@ with {{{packageName}}}.ApiClient(configuration) as api_client: try: {{#summary}} # {{{.}}} - {{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}} + {{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}} pprint(api_response){{/returnType}} except {{{packageName}}}.ApiException as e: print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) @@ -75,5 +75,5 @@ Class | Method | HTTP request | Description ## Author -{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} -{{/hasMore}}{{/apis}}{{/apiInfo}} +{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} +{{/-last}}{{/apis}}{{/apiInfo}} diff --git a/openapi-generator/templates/python/python-experimental/api.mustache b/openapi-generator/templates/python/python-experimental/api.mustache index 4cf1d423..88570054 100644 --- a/openapi-generator/templates/python/python-experimental/api.mustache +++ b/openapi-generator/templates/python/python-experimental/api.mustache @@ -70,9 +70,9 @@ class {{classname}}(object): >>> result = thread.get() {{#requiredParams}} -{{^hasMore}} +{{#-last}} Args: -{{/hasMore}} +{{/-last}} {{/requiredParams}} {{#requiredParams}} {{^defaultValue}} @@ -144,7 +144,7 @@ class {{classname}}(object): {{#-first}} 'auth': [ {{/-first}} - '{{name}}'{{#hasMore}},{{/hasMore}} + '{{name}}'{{^-last}},{{/-last}} {{#-last}} ], {{/-last}} @@ -269,7 +269,7 @@ class {{classname}}(object): {{#hasProduces}} 'accept': [ {{#produces}} - '{{{mediaType}}}'{{#hasMore}},{{/hasMore}} + '{{{mediaType}}}'{{^-last}},{{/-last}} {{/produces}} ], {{/hasProduces}} @@ -279,7 +279,7 @@ class {{classname}}(object): {{#hasConsumes}} 'content_type': [ {{#consumes}} - '{{{mediaType}}}'{{#hasMore}},{{/hasMore}} + '{{{mediaType}}}'{{^-last}},{{/-last}} {{/consumes}} ] {{/hasConsumes}} diff --git a/openapi-generator/templates/python/python-experimental/api_doc.mustache b/openapi-generator/templates/python/python-experimental/api_doc.mustache index 10317b4b..f9dac707 100644 --- a/openapi-generator/templates/python/python-experimental/api_doc.mustache +++ b/openapi-generator/templates/python/python-experimental/api_doc.mustache @@ -11,7 +11,7 @@ Method | HTTP request | Description {{#operations}} {{#operation}} # **{{{operationId}}}** -> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#requiredParams}}{{^defaultValue}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/defaultValue}}{{/requiredParams}}) +> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#requiredParams}}{{^defaultValue}}{{paramName}}{{^-last}}, {{/-last}}{{/defaultValue}}{{/requiredParams}}) {{{summary}}}{{#notes}} @@ -57,8 +57,8 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} - - **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} + - **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} {{#responses.0}} ### HTTP response details diff --git a/openapi-generator/templates/python/python-experimental/api_doc_example.mustache b/openapi-generator/templates/python/python-experimental/api_doc_example.mustache index ae7b8a69..ed234f5a 100644 --- a/openapi-generator/templates/python/python-experimental/api_doc_example.mustache +++ b/openapi-generator/templates/python/python-experimental/api_doc_example.mustache @@ -17,29 +17,29 @@ with {{{packageName}}}.ApiClient() as api_client: {{/defaultValue}}{{/requiredParams}}{{#optionalParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}} {{/optionalParams}} {{#requiredParams}} - {{^hasMore}} + {{#-last}} # example passing only required values which don't have defaults set try: {{#summary}} # {{{.}}} - {{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#requiredParams}}{{^defaultValue}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/defaultValue}}{{/requiredParams}}){{#returnType}} + {{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#requiredParams}}{{^defaultValue}}{{paramName}}{{^-last}}, {{/-last}}{{/defaultValue}}{{/requiredParams}}){{#returnType}} pprint(api_response){{/returnType}} except {{{packageName}}}.ApiException as e: print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) - {{/hasMore}} + {{/-last}} {{/requiredParams}} {{#optionalParams}} - {{^hasMore}} + {{#-last}} # example passing only required values which don't have defaults set # and optional values try: {{#summary}} # {{{.}}} - {{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#requiredParams}}{{^defaultValue}}{{paramName}}, {{/defaultValue}}{{/requiredParams}}{{#optionalParams}}{{paramName}}={{paramName}}{{#hasMore}}, {{/hasMore}}{{/optionalParams}}){{#returnType}} + {{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#requiredParams}}{{^defaultValue}}{{paramName}}, {{/defaultValue}}{{/requiredParams}}{{#optionalParams}}{{paramName}}={{paramName}}{{^-last}}, {{/-last}}{{/optionalParams}}){{#returnType}} pprint(api_response){{/returnType}} except {{{packageName}}}.ApiException as e: print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) - {{/hasMore}} + {{/-last}} {{/optionalParams}} {{^requiredParams}} {{^optionalParams}} diff --git a/openapi-generator/templates/python/python-experimental/setup.mustache b/openapi-generator/templates/python/python-experimental/setup.mustache index 796475c4..656e5b1e 100644 --- a/openapi-generator/templates/python/python-experimental/setup.mustache +++ b/openapi-generator/templates/python/python-experimental/setup.mustache @@ -8,7 +8,7 @@ NAME = "{{{projectName}}}" VERSION = "{{packageVersion}}" {{#apiInfo}} {{#apis}} -{{^hasMore}} +{{#-last}} # To install the library, run the following # # python setup.py install @@ -52,6 +52,6 @@ setup( {{appDescription}} # noqa: E501 """ ) -{{/hasMore}} +{{/-last}} {{/apis}} {{/apiInfo}} diff --git a/openapi-generator/templates/python/setup.mustache b/openapi-generator/templates/python/setup.mustache index f542da3e..de5fd3f9 100644 --- a/openapi-generator/templates/python/setup.mustache +++ b/openapi-generator/templates/python/setup.mustache @@ -8,7 +8,7 @@ NAME = "{{{projectName}}}" VERSION = "{{packageVersion}}" {{#apiInfo}} {{#apis}} -{{^hasMore}} +{{#-last}} # To install the library, run the following # # python setup.py install @@ -40,6 +40,6 @@ setup( Phrase Strings is a translation management platform for software projects. You can collaborate on language file translation with your team or order translations through our platform. The API allows you to import locale files, download locale files, tag keys or interact in other ways with the localization data stored in Phrase Strings for your account. """ ) -{{/hasMore}} +{{/-last}} {{/apis}} {{/apiInfo}} diff --git a/openapi-generator/templates/ruby-client/README.mustache b/openapi-generator/templates/ruby-client/README.mustache index d95e2ea0..7ff12888 100644 --- a/openapi-generator/templates/ruby-client/README.mustache +++ b/openapi-generator/templates/ruby-client/README.mustache @@ -115,7 +115,22 @@ end {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} ``` -{{>../shared/datacenters}} +## Datacenters + +The API is only accessible via HTTPS and the current version is v2, which results in a base URL like: {{{basePath}}} depending on the datacenter. + +### EU Datacenter +``` +{{{basePath}}} +``` + +This is the default datacenter. + +### US Datacenter +``` +https://api.us.app.phrase.com/v2/ +``` + ### Specifying US Datacenter You can use the US datacenter by setting the following: ``` diff --git a/openapi-generator/templates/ruby-client/api.mustache b/openapi-generator/templates/ruby-client/api.mustache index b0c4e8c4..52301fef 100644 --- a/openapi-generator/templates/ruby-client/api.mustache +++ b/openapi-generator/templates/ruby-client/api.mustache @@ -138,11 +138,11 @@ module {{moduleName}} header_params = opts[:header_params] || {} {{#hasProduces}} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept([{{#produces}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/produces}}]) + header_params['Accept'] = @api_client.select_header_accept([{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}]) {{/hasProduces}} {{#hasConsumes}} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type([{{#consumes}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}]) + header_params['Content-Type'] = @api_client.select_header_content_type([{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}]) {{/hasConsumes}} {{#headerParams}} {{#required}} @@ -175,7 +175,7 @@ module {{moduleName}} return_type = opts[:return_type] {{#returnType}}|| '{{{returnType}}}' {{/returnType}} # auth_names - auth_names = opts[:auth_names] || [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}] + auth_names = opts[:auth_names] || [{{#authMethods}}'{{name}}'{{^-last}}, {{/-last}}{{/authMethods}}] new_options = opts.merge( :header_params => header_params, diff --git a/openapi-generator/templates/ruby-client/api_doc.mustache b/openapi-generator/templates/ruby-client/api_doc.mustache index 41ec8240..324952f1 100644 --- a/openapi-generator/templates/ruby-client/api_doc.mustache +++ b/openapi-generator/templates/ruby-client/api_doc.mustache @@ -43,13 +43,13 @@ require '{{{gemName}}}' api_instance = {{{moduleName}}}::{{{classname}}}.new {{#requiredParams}} -{{{paramName}}} = {{{example}}} # {{{dataType}}} | {{{description}}} +{{{paramName}}} = {{{vendorExtensions.x-ruby-example}}} # {{{dataType}}} | {{{description}}} {{/requiredParams}} {{#optionalParams}} {{#-first}} opts = { {{/-first}} - {{{paramName}}}: {{{example}}}{{^-last}},{{/-last}} # {{{dataType}}} | {{{description}}} + {{{paramName}}}: {{{vendorExtensions.x-ruby-example}}}{{^-last}},{{/-last}} # {{{dataType}}} | {{{description}}} {{#-last}} } {{/-last}} @@ -82,8 +82,8 @@ Response<({{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTy ### HTTP request headers -- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} -- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} +- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} +- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} {{/operation}} {{/operations}} diff --git a/openapi-generator/templates/ruby-client/base_object.mustache b/openapi-generator/templates/ruby-client/base_object.mustache index cf4a62a9..ce9bdfeb 100644 --- a/openapi-generator/templates/ruby-client/base_object.mustache +++ b/openapi-generator/templates/ruby-client/base_object.mustache @@ -38,6 +38,8 @@ DateTime.parse(value) when :Date Date.parse(value) + when :Time + Time.parse(value) when :String value.to_s when :Integer @@ -91,7 +93,7 @@ is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end - + hash[param] = _to_hash(value) end hash diff --git a/openapi-generator/templates/ruby-client/partial_model_generic.mustache b/openapi-generator/templates/ruby-client/partial_model_generic.mustache index 536d8f29..78330b16 100644 --- a/openapi-generator/templates/ruby-client/partial_model_generic.mustache +++ b/openapi-generator/templates/ruby-client/partial_model_generic.mustache @@ -37,7 +37,7 @@ def self.attribute_map { {{#vars}} - :'{{{name}}}' => :'{{{baseName}}}'{{#hasMore}},{{/hasMore}} + :'{{{name}}}' => :'{{{baseName}}}'{{^-last}},{{/-last}} {{/vars}} } end @@ -46,7 +46,7 @@ def self.openapi_types { {{#vars}} - :'{{{name}}}' => :'{{{dataType}}}'{{#hasMore}},{{/hasMore}} + :'{{{name}}}' => :'{{^isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isDateTime}}DateTime{{/isDateTime}}'{{^-last}},{{/-last}} {{/vars}} } end @@ -56,7 +56,7 @@ Set.new([ {{#vars}} {{#isNullable}} - :'{{{name}}}'{{#hasMore}},{{/hasMore}} + :'{{{name}}}'{{^-last}},{{/-last}} {{/isNullable}} {{/vars}} ]) @@ -132,16 +132,16 @@ {{#vars}} if attributes.key?(:'{{{name}}}') - {{#isListContainer}} + {{#isArray}} if (value = attributes[:'{{{name}}}']).is_a?(Array) self.{{{name}}} = value end - {{/isListContainer}} - {{#isMapContainer}} + {{/isArray}} + {{#isMap}} if (value = attributes[:'{{{name}}}']).is_a?(Hash) self.{{{name}}} = value end - {{/isMapContainer}} + {{/isMap}} {{^isContainer}} self.{{{name}}} = attributes[:'{{{name}}}'] {{/isContainer}} @@ -387,7 +387,7 @@ # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [{{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}].hash + [{{#vars}}{{name}}{{^-last}}, {{/-last}}{{/vars}}].hash end {{> base_object}} diff --git a/openapi-generator/templates/typescript-fetch/README.mustache b/openapi-generator/templates/typescript-fetch/README.mustache index c23ab1a5..65a21403 100644 --- a/openapi-generator/templates/typescript-fetch/README.mustache +++ b/openapi-generator/templates/typescript-fetch/README.mustache @@ -175,7 +175,22 @@ const requestParams = { }; ``` -{{>../shared/datacenters}} +## Datacenters + +The API is only accessible via HTTPS and the current version is v2, which results in a base URL like: {{{basePath}}} depending on the datacenter. + +### EU Datacenter +``` +{{{basePath}}} +``` + +This is the default datacenter. + +### US Datacenter +``` +https://api.us.app.phrase.com/v2/ +``` + ### Specifying US Datacenter You can use the US datacenter by setting the following: ``` @@ -193,8 +208,8 @@ Class | Method | HTTP request | Description ## Author -{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} -{{/hasMore}}{{/apis}}{{/apiInfo}} +{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} +{{/-last}}{{/apis}}{{/apiInfo}} ## Get help / support diff --git a/openapi-generator/templates/typescript-fetch/apis.mustache b/openapi-generator/templates/typescript-fetch/apis.mustache index 92192879..83bc72bd 100644 --- a/openapi-generator/templates/typescript-fetch/apis.mustache +++ b/openapi-generator/templates/typescript-fetch/apis.mustache @@ -58,7 +58,7 @@ export interface {{classname}}Interface { {{/summary}} */ {{^useSingleRequestParameter}} - {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}any{{/returnType}}>; + {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}{{^-last}}, {{/-last}}{{/allParams}}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}any{{/returnType}}>; {{/useSingleRequestParameter}} {{#useSingleRequestParameter}} {{nickname}}({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{/allParams.0}}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}any{{/returnType}}>; @@ -101,7 +101,7 @@ export class {{classname}} extends runtime.BaseAPI { const queryParameters: any = {}; {{#queryParams}} - {{#isListContainer}} + {{#isArray}} if (requestParameters.{{paramName}}) { {{#isCollectionFormatMulti}} queryParameters['{{baseName}}'] = requestParameters.{{paramName}}; @@ -111,8 +111,8 @@ export class {{classname}} extends runtime.BaseAPI { {{/isCollectionFormatMulti}} } - {{/isListContainer}} - {{^isListContainer}} + {{/isArray}} + {{^isArray}} if (requestParameters.{{paramName}} !== undefined) { {{#isDateTime}} queryParameters['{{baseName}}'] = (requestParameters.{{paramName}} as any).toISOString(); @@ -127,7 +127,7 @@ export class {{classname}} extends runtime.BaseAPI { {{/isDateTime}} } - {{/isListContainer}} + {{/isArray}} {{/queryParams}} const headerParameters: runtime.HTTPHeaders = {}; @@ -142,18 +142,18 @@ export class {{classname}} extends runtime.BaseAPI { {{/consumes.0}} {{/bodyParam}} {{#headerParams}} - {{#isListContainer}} + {{#isArray}} if (requestParameters.{{paramName}}) { headerParameters['{{baseName}}'] = requestParameters.{{paramName}}.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"]); } - {{/isListContainer}} - {{^isListContainer}} + {{/isArray}} + {{^isArray}} if (requestParameters.{{paramName}} !== undefined && requestParameters.{{paramName}} !== null) { headerParameters['{{baseName}}'] = String(requestParameters.{{paramName}}); } - {{/isListContainer}} + {{/isArray}} {{/headerParams}} {{#authMethods}} {{#isBasic}} @@ -223,7 +223,7 @@ export class {{classname}} extends runtime.BaseAPI { } {{#formParams}} - {{#isListContainer}} + {{#isArray}} if (requestParameters.{{paramName}}) { {{#isCollectionFormatMulti}} requestParameters.{{paramName}}.forEach((element) => { @@ -235,8 +235,8 @@ export class {{classname}} extends runtime.BaseAPI { {{/isCollectionFormatMulti}} } - {{/isListContainer}} - {{^isListContainer}} + {{/isArray}} + {{^isArray}} if (requestParameters.{{paramName}} !== undefined) { {{#isFreeFormObject}} this.flattenDeepParams({ @@ -250,7 +250,7 @@ export class {{classname}} extends runtime.BaseAPI { {{/isFreeFormObject}} } - {{/isListContainer}} + {{/isArray}} {{/formParams}} {{/hasFormParams}} const response = await this.request({ @@ -261,7 +261,7 @@ export class {{classname}} extends runtime.BaseAPI { {{#hasBodyParam}} {{#bodyParam}} {{#isContainer}} - body: requestParameters.{{paramName}}{{#isListContainer}}{{#items}}{{^isPrimitiveType}}.map({{datatype}}ToJSON){{/isPrimitiveType}}{{/items}}{{/isListContainer}}, + body: requestParameters.{{paramName}}{{#isArray}}{{#items}}{{^isPrimitiveType}}.map({{datatype}}ToJSON){{/isPrimitiveType}}{{/items}}{{/isArray}}, {{/isContainer}} {{^isContainer}} {{^isPrimitiveType}} @@ -284,28 +284,28 @@ export class {{classname}} extends runtime.BaseAPI { {{/isResponseFile}} {{^isResponseFile}} {{#returnTypeIsPrimitive}} - {{#isMapContainer}} + {{#isMap}} return new runtime.JSONApiResponse(response); - {{/isMapContainer}} - {{#isListContainer}} + {{/isMap}} + {{#isArray}} return new runtime.JSONApiResponse(response); - {{/isListContainer}} + {{/isArray}} {{#returnSimpleType}} return new runtime.TextApiResponse(response) as any; {{/returnSimpleType}} {{/returnTypeIsPrimitive}} {{^returnTypeIsPrimitive}} - {{#isListContainer}} + {{#isArray}} return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map({{returnBaseType}}FromJSON)); - {{/isListContainer}} - {{^isListContainer}} - {{#isMapContainer}} + {{/isArray}} + {{^isArray}} + {{#isMap}} return new runtime.JSONApiResponse(response, (jsonValue) => runtime.mapValues(jsonValue, {{returnBaseType}}FromJSON)); - {{/isMapContainer}} - {{^isMapContainer}} + {{/isMap}} + {{^isMap}} return new runtime.JSONApiResponse(response, (jsonValue) => {{returnBaseType}}FromJSON(jsonValue)); - {{/isMapContainer}} - {{/isListContainer}} + {{/isMap}} + {{/isArray}} {{/returnTypeIsPrimitive}} {{/isResponseFile}} {{/returnType}} @@ -323,13 +323,13 @@ export class {{classname}} extends runtime.BaseAPI { {{/summary}} */ {{^useSingleRequestParameter}} - async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}any{{/returnType}}> { + async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}{{^-last}}, {{/-last}}{{/allParams}}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}any{{/returnType}}> { {{#returnType}} - const response = await this.{{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}} }{{/allParams.0}}); + const response = await this.{{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }{{/allParams.0}}); return await response.value(); {{/returnType}} {{^returnType}} - await this.{{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}} }{{/allParams.0}}); + await this.{{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }{{/allParams.0}}); {{/returnType}} } {{/useSingleRequestParameter}} diff --git a/openapi-generator/templates/typescript-fetch/modelGeneric.mustache b/openapi-generator/templates/typescript-fetch/modelGeneric.mustache index ca183794..2f6b9efc 100644 --- a/openapi-generator/templates/typescript-fetch/modelGeneric.mustache +++ b/openapi-generator/templates/typescript-fetch/modelGeneric.mustache @@ -75,22 +75,22 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole {{/isDate}} {{/isPrimitiveType}} {{^isPrimitiveType}} - {{#isListContainer}} + {{#isArray}} '{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}({{#isNullable}}json['{{baseName}}'] === null ? null : {{/isNullable}}(json['{{baseName}}'] as Array).map({{#items}}{{datatype}}{{/items}}FromJSON)), - {{/isListContainer}} - {{#isMapContainer}} + {{/isArray}} + {{#isMap}} '{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}({{#isNullable}}json['{{baseName}}'] === null ? null : {{/isNullable}}mapValues(json['{{baseName}}'], {{#items}}{{datatype}}{{/items}}FromJSON)), - {{/isMapContainer}} - {{^isListContainer}} - {{^isMapContainer}} + {{/isMap}} + {{^isArray}} + {{^isMap}} {{^isFreeFormObject}} '{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}{{datatype}}FromJSON(json['{{baseName}}']), {{/isFreeFormObject}} {{#isFreeFormObject}} '{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}json['{{baseName}}'], {{/isFreeFormObject}} - {{/isMapContainer}} - {{/isListContainer}} + {{/isMap}} + {{/isArray}} {{/isPrimitiveType}} {{/vars}} }; @@ -119,22 +119,22 @@ export function {{classname}}ToJSON(value?: {{classname}} | null): any { '{{baseName}}': {{#isDate}}{{^required}}value.{{name}} === undefined ? undefined : {{/required}}({{#isNullable}}value.{{name}} === null ? null : {{/isNullable}}value.{{name}}.toISOString().substr(0,10)){{/isDate}}{{#isDateTime}}{{^required}}value.{{name}} === undefined ? undefined : {{/required}}({{#isNullable}}value.{{name}} === null ? null : {{/isNullable}}value.{{name}}.toISOString()){{/isDateTime}}{{^isDate}}{{^isDateTime}}value.{{name}}{{/isDateTime}}{{/isDate}}, {{/isPrimitiveType}} {{^isPrimitiveType}} - {{#isListContainer}} + {{#isArray}} '{{baseName}}': {{^required}}value.{{name}} === undefined ? undefined : {{/required}}({{#isNullable}}value.{{name}} === null ? null : {{/isNullable}}(value.{{name}} as Array).map({{#items}}{{datatype}}{{/items}}ToJSON)), - {{/isListContainer}} - {{#isMapContainer}} + {{/isArray}} + {{#isMap}} '{{baseName}}': {{^required}}value.{{name}} === undefined ? undefined : {{/required}}({{#isNullable}}value.{{name}} === null ? null : {{/isNullable}}mapValues(value.{{name}}, {{#items}}{{datatype}}{{/items}}ToJSON)), - {{/isMapContainer}} - {{^isListContainer}} - {{^isMapContainer}} + {{/isMap}} + {{^isArray}} + {{^isMap}} {{^isFreeFormObject}} '{{baseName}}': {{datatype}}ToJSON(value.{{name}}), {{/isFreeFormObject}} {{#isFreeFormObject}} '{{baseName}}': value.{{name}}, {{/isFreeFormObject}} - {{/isMapContainer}} - {{/isListContainer}} + {{/isMap}} + {{/isArray}} {{/isPrimitiveType}} {{/isReadOnly}} {{/vars}} diff --git a/openapitools.json b/openapitools.json index 0c86cdc2..4053ae89 100644 --- a/openapitools.json +++ b/openapitools.json @@ -2,6 +2,6 @@ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "4.3.1" + "version": "7.0.1" } }