From 97e079fde0dd6cb3f589e1d80254c432642927dd Mon Sep 17 00:00:00 2001
From: itaru2622 <70509350+itaru2622@users.noreply.github.com>
Date: Tue, 26 Oct 2021 17:12:42 +0900
Subject: [PATCH 01/25] add no_proxy support to python client (#10648)
* add no_proxy support to python client
* add unittest for no_proxy supporting, python client
* update samples for no_proxy supporting, python client
* fix input parameter in samples/openapi3/.../tests_manual/test_extra_pool_config_options.py
* re-implement no_proxy support to python client according to PR conversation #10648
* re-update samples for no_proxy supporting, python client
---
.../resources/python/configuration.mustache | 3 +
.../src/main/resources/python/rest.mustache | 58 ++++++++++++++++++-
.../codegen/python/PythonClientTest.java | 23 ++++++++
.../python/petstore_api/configuration.py | 3 +
.../petstore/python/petstore_api/rest.py | 58 ++++++++++++++++++-
.../petstore_api/configuration.py | 3 +
.../petstore_api/rest.py | 58 ++++++++++++++++++-
.../python/x_auth_id_alias/configuration.py | 3 +
.../python/x_auth_id_alias/rest.py | 58 ++++++++++++++++++-
.../python/dynamic_servers/configuration.py | 3 +
.../python/dynamic_servers/rest.py | 58 ++++++++++++++++++-
.../python/petstore_api/configuration.py | 3 +
.../petstore/python/petstore_api/rest.py | 58 ++++++++++++++++++-
.../test_extra_pool_config_options.py | 4 +-
14 files changed, 379 insertions(+), 14 deletions(-)
diff --git a/modules/openapi-generator/src/main/resources/python/configuration.mustache b/modules/openapi-generator/src/main/resources/python/configuration.mustache
index ac15aa430ea..8e586cf68ce 100644
--- a/modules/openapi-generator/src/main/resources/python/configuration.mustache
+++ b/modules/openapi-generator/src/main/resources/python/configuration.mustache
@@ -278,6 +278,9 @@ conf = {{{packageName}}}.Configuration(
self.proxy = None
"""Proxy URL
"""
+ self.no_proxy = None
+ """bypass proxy for host in the no_proxy list.
+ """
self.proxy_headers = None
"""Proxy headers
"""
diff --git a/modules/openapi-generator/src/main/resources/python/rest.mustache b/modules/openapi-generator/src/main/resources/python/rest.mustache
index 21c8d5b44c0..d4293e70da2 100644
--- a/modules/openapi-generator/src/main/resources/python/rest.mustache
+++ b/modules/openapi-generator/src/main/resources/python/rest.mustache
@@ -6,8 +6,10 @@ import logging
import re
import ssl
from urllib.parse import urlencode
-
+from urllib.parse import urlparse
+from urllib.request import proxy_bypass_environment
import urllib3
+import ipaddress
from {{packageName}}.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError
@@ -64,7 +66,7 @@ class RESTClientObject(object):
maxsize = 4
# https pool manager
- if configuration.proxy:
+ if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''):
self.pool_manager = urllib3.ProxyManager(
num_pools=pools_size,
maxsize=maxsize,
@@ -282,3 +284,55 @@ class RESTClientObject(object):
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
+
+# end of class RESTClientObject
+def is_ipv4(target):
+ """ Test if IPv4 address or not
+ """
+ try:
+ chk = ipaddress.IPv4Address(target)
+ return True
+ except ipaddress.AddressValueError:
+ return False
+
+def in_ipv4net(target, net):
+ """ Test if target belongs to given IPv4 network
+ """
+ try:
+ nw = ipaddress.IPv4Network(net)
+ ip = ipaddress.IPv4Address(target)
+ if ip in nw:
+ return True
+ return False
+ except ipaddress.AddressValueError:
+ return False
+ except ipaddress.NetmaskValueError:
+ return False
+
+def should_bypass_proxies(url, no_proxy=None):
+ """ Yet another requests.should_bypass_proxies
+ Test if proxies should not be used for a particular url.
+ """
+
+ parsed = urlparse(url)
+
+ # special cases
+ if parsed.hostname in [None, '']:
+ return True
+
+ # special cases
+ if no_proxy in [None , '']:
+ return False
+ if no_proxy == '*':
+ return True
+
+ no_proxy = no_proxy.lower().replace(' ','');
+ entries = (
+ host for host in no_proxy.split(',') if host
+ )
+
+ if is_ipv4(parsed.hostname):
+ for item in entries:
+ if in_ipv4net(parsed.hostname, item):
+ return True
+ return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} )
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientTest.java
index 2ba80266215..bb470c5c315 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientTest.java
@@ -29,6 +29,7 @@ import io.swagger.v3.parser.util.SchemaTypeUtil;
import java.io.File;
import java.math.BigDecimal;
import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -464,4 +465,26 @@ public class PythonClientTest {
}
+ @Test(description = "tests NoProxyPyClient")
+ public void testNoProxyPyClient() throws Exception {
+
+ final String gen = "python";
+ final String spec = "src/test/resources/3_0/petstore.yaml";
+
+ File output = Files.createTempDirectory("test").toFile();
+ final CodegenConfigurator configurator = new CodegenConfigurator()
+ .setGeneratorName(gen)
+ .setInputSpec(spec)
+ .setOutputDir(output.getAbsolutePath().replace("\\", "/"));
+ final ClientOptInput clientOptInput = configurator.toClientOptInput();
+ DefaultGenerator generator = new DefaultGenerator();
+ List files = generator.opts(clientOptInput).generate();
+
+ for (String f : new String[] { "openapi_client/configuration.py", "openapi_client/rest.py" } ) {
+ TestUtils.ensureContainsFile(files, output, f);
+ Path p = output.toPath().resolve(f);
+ TestUtils.assertFileContains(p, "no_proxy");
+ }
+ }
+
}
diff --git a/samples/client/petstore/python/petstore_api/configuration.py b/samples/client/petstore/python/petstore_api/configuration.py
index 8fc4edbf89a..e6e4596df11 100644
--- a/samples/client/petstore/python/petstore_api/configuration.py
+++ b/samples/client/petstore/python/petstore_api/configuration.py
@@ -215,6 +215,9 @@ conf = petstore_api.Configuration(
self.proxy = None
"""Proxy URL
"""
+ self.no_proxy = None
+ """bypass proxy for host in the no_proxy list.
+ """
self.proxy_headers = None
"""Proxy headers
"""
diff --git a/samples/client/petstore/python/petstore_api/rest.py b/samples/client/petstore/python/petstore_api/rest.py
index a38fcec1c84..476138a6bc8 100644
--- a/samples/client/petstore/python/petstore_api/rest.py
+++ b/samples/client/petstore/python/petstore_api/rest.py
@@ -14,8 +14,10 @@ import logging
import re
import ssl
from urllib.parse import urlencode
-
+from urllib.parse import urlparse
+from urllib.request import proxy_bypass_environment
import urllib3
+import ipaddress
from petstore_api.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError
@@ -72,7 +74,7 @@ class RESTClientObject(object):
maxsize = 4
# https pool manager
- if configuration.proxy:
+ if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''):
self.pool_manager = urllib3.ProxyManager(
num_pools=pools_size,
maxsize=maxsize,
@@ -290,3 +292,55 @@ class RESTClientObject(object):
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
+
+# end of class RESTClientObject
+def is_ipv4(target):
+ """ Test if IPv4 address or not
+ """
+ try:
+ chk = ipaddress.IPv4Address(target)
+ return True
+ except ipaddress.AddressValueError:
+ return False
+
+def in_ipv4net(target, net):
+ """ Test if target belongs to given IPv4 network
+ """
+ try:
+ nw = ipaddress.IPv4Network(net)
+ ip = ipaddress.IPv4Address(target)
+ if ip in nw:
+ return True
+ return False
+ except ipaddress.AddressValueError:
+ return False
+ except ipaddress.NetmaskValueError:
+ return False
+
+def should_bypass_proxies(url, no_proxy=None):
+ """ Yet another requests.should_bypass_proxies
+ Test if proxies should not be used for a particular url.
+ """
+
+ parsed = urlparse(url)
+
+ # special cases
+ if parsed.hostname in [None, '']:
+ return True
+
+ # special cases
+ if no_proxy in [None , '']:
+ return False
+ if no_proxy == '*':
+ return True
+
+ no_proxy = no_proxy.lower().replace(' ','');
+ entries = (
+ host for host in no_proxy.split(',') if host
+ )
+
+ if is_ipv4(parsed.hostname):
+ for item in entries:
+ if in_ipv4net(parsed.hostname, item):
+ return True
+ return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} )
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/configuration.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/configuration.py
index 8fc4edbf89a..e6e4596df11 100644
--- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/configuration.py
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/configuration.py
@@ -215,6 +215,9 @@ conf = petstore_api.Configuration(
self.proxy = None
"""Proxy URL
"""
+ self.no_proxy = None
+ """bypass proxy for host in the no_proxy list.
+ """
self.proxy_headers = None
"""Proxy headers
"""
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/rest.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/rest.py
index a38fcec1c84..476138a6bc8 100644
--- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/rest.py
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/rest.py
@@ -14,8 +14,10 @@ import logging
import re
import ssl
from urllib.parse import urlencode
-
+from urllib.parse import urlparse
+from urllib.request import proxy_bypass_environment
import urllib3
+import ipaddress
from petstore_api.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError
@@ -72,7 +74,7 @@ class RESTClientObject(object):
maxsize = 4
# https pool manager
- if configuration.proxy:
+ if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''):
self.pool_manager = urllib3.ProxyManager(
num_pools=pools_size,
maxsize=maxsize,
@@ -290,3 +292,55 @@ class RESTClientObject(object):
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
+
+# end of class RESTClientObject
+def is_ipv4(target):
+ """ Test if IPv4 address or not
+ """
+ try:
+ chk = ipaddress.IPv4Address(target)
+ return True
+ except ipaddress.AddressValueError:
+ return False
+
+def in_ipv4net(target, net):
+ """ Test if target belongs to given IPv4 network
+ """
+ try:
+ nw = ipaddress.IPv4Network(net)
+ ip = ipaddress.IPv4Address(target)
+ if ip in nw:
+ return True
+ return False
+ except ipaddress.AddressValueError:
+ return False
+ except ipaddress.NetmaskValueError:
+ return False
+
+def should_bypass_proxies(url, no_proxy=None):
+ """ Yet another requests.should_bypass_proxies
+ Test if proxies should not be used for a particular url.
+ """
+
+ parsed = urlparse(url)
+
+ # special cases
+ if parsed.hostname in [None, '']:
+ return True
+
+ # special cases
+ if no_proxy in [None , '']:
+ return False
+ if no_proxy == '*':
+ return True
+
+ no_proxy = no_proxy.lower().replace(' ','');
+ entries = (
+ host for host in no_proxy.split(',') if host
+ )
+
+ if is_ipv4(parsed.hostname):
+ for item in entries:
+ if in_ipv4net(parsed.hostname, item):
+ return True
+ return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} )
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/configuration.py b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/configuration.py
index e5e2f7d53e3..d3b86dbde09 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/configuration.py
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/configuration.py
@@ -199,6 +199,9 @@ conf = x_auth_id_alias.Configuration(
self.proxy = None
"""Proxy URL
"""
+ self.no_proxy = None
+ """bypass proxy for host in the no_proxy list.
+ """
self.proxy_headers = None
"""Proxy headers
"""
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/rest.py b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/rest.py
index a7c5fd3304a..c3566a6d0b2 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/rest.py
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/rest.py
@@ -14,8 +14,10 @@ import logging
import re
import ssl
from urllib.parse import urlencode
-
+from urllib.parse import urlparse
+from urllib.request import proxy_bypass_environment
import urllib3
+import ipaddress
from x_auth_id_alias.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError
@@ -72,7 +74,7 @@ class RESTClientObject(object):
maxsize = 4
# https pool manager
- if configuration.proxy:
+ if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''):
self.pool_manager = urllib3.ProxyManager(
num_pools=pools_size,
maxsize=maxsize,
@@ -290,3 +292,55 @@ class RESTClientObject(object):
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
+
+# end of class RESTClientObject
+def is_ipv4(target):
+ """ Test if IPv4 address or not
+ """
+ try:
+ chk = ipaddress.IPv4Address(target)
+ return True
+ except ipaddress.AddressValueError:
+ return False
+
+def in_ipv4net(target, net):
+ """ Test if target belongs to given IPv4 network
+ """
+ try:
+ nw = ipaddress.IPv4Network(net)
+ ip = ipaddress.IPv4Address(target)
+ if ip in nw:
+ return True
+ return False
+ except ipaddress.AddressValueError:
+ return False
+ except ipaddress.NetmaskValueError:
+ return False
+
+def should_bypass_proxies(url, no_proxy=None):
+ """ Yet another requests.should_bypass_proxies
+ Test if proxies should not be used for a particular url.
+ """
+
+ parsed = urlparse(url)
+
+ # special cases
+ if parsed.hostname in [None, '']:
+ return True
+
+ # special cases
+ if no_proxy in [None , '']:
+ return False
+ if no_proxy == '*':
+ return True
+
+ no_proxy = no_proxy.lower().replace(' ','');
+ entries = (
+ host for host in no_proxy.split(',') if host
+ )
+
+ if is_ipv4(parsed.hostname):
+ for item in entries:
+ if in_ipv4net(parsed.hostname, item):
+ return True
+ return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} )
diff --git a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/configuration.py b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/configuration.py
index e90b08da266..afda4f4fd36 100644
--- a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/configuration.py
+++ b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/configuration.py
@@ -179,6 +179,9 @@ class Configuration(object):
self.proxy = None
"""Proxy URL
"""
+ self.no_proxy = None
+ """bypass proxy for host in the no_proxy list.
+ """
self.proxy_headers = None
"""Proxy headers
"""
diff --git a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/rest.py b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/rest.py
index 191d850b87d..b73beb6fd00 100644
--- a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/rest.py
+++ b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/rest.py
@@ -14,8 +14,10 @@ import logging
import re
import ssl
from urllib.parse import urlencode
-
+from urllib.parse import urlparse
+from urllib.request import proxy_bypass_environment
import urllib3
+import ipaddress
from dynamic_servers.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError
@@ -72,7 +74,7 @@ class RESTClientObject(object):
maxsize = 4
# https pool manager
- if configuration.proxy:
+ if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''):
self.pool_manager = urllib3.ProxyManager(
num_pools=pools_size,
maxsize=maxsize,
@@ -290,3 +292,55 @@ class RESTClientObject(object):
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
+
+# end of class RESTClientObject
+def is_ipv4(target):
+ """ Test if IPv4 address or not
+ """
+ try:
+ chk = ipaddress.IPv4Address(target)
+ return True
+ except ipaddress.AddressValueError:
+ return False
+
+def in_ipv4net(target, net):
+ """ Test if target belongs to given IPv4 network
+ """
+ try:
+ nw = ipaddress.IPv4Network(net)
+ ip = ipaddress.IPv4Address(target)
+ if ip in nw:
+ return True
+ return False
+ except ipaddress.AddressValueError:
+ return False
+ except ipaddress.NetmaskValueError:
+ return False
+
+def should_bypass_proxies(url, no_proxy=None):
+ """ Yet another requests.should_bypass_proxies
+ Test if proxies should not be used for a particular url.
+ """
+
+ parsed = urlparse(url)
+
+ # special cases
+ if parsed.hostname in [None, '']:
+ return True
+
+ # special cases
+ if no_proxy in [None , '']:
+ return False
+ if no_proxy == '*':
+ return True
+
+ no_proxy = no_proxy.lower().replace(' ','');
+ entries = (
+ host for host in no_proxy.split(',') if host
+ )
+
+ if is_ipv4(parsed.hostname):
+ for item in entries:
+ if in_ipv4net(parsed.hostname, item):
+ return True
+ return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} )
diff --git a/samples/openapi3/client/petstore/python/petstore_api/configuration.py b/samples/openapi3/client/petstore/python/petstore_api/configuration.py
index 9042d98826a..44b3f666ac2 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/configuration.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/configuration.py
@@ -262,6 +262,9 @@ conf = petstore_api.Configuration(
self.proxy = None
"""Proxy URL
"""
+ self.no_proxy = None
+ """bypass proxy for host in the no_proxy list.
+ """
self.proxy_headers = None
"""Proxy headers
"""
diff --git a/samples/openapi3/client/petstore/python/petstore_api/rest.py b/samples/openapi3/client/petstore/python/petstore_api/rest.py
index a38fcec1c84..476138a6bc8 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/rest.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/rest.py
@@ -14,8 +14,10 @@ import logging
import re
import ssl
from urllib.parse import urlencode
-
+from urllib.parse import urlparse
+from urllib.request import proxy_bypass_environment
import urllib3
+import ipaddress
from petstore_api.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError
@@ -72,7 +74,7 @@ class RESTClientObject(object):
maxsize = 4
# https pool manager
- if configuration.proxy:
+ if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''):
self.pool_manager = urllib3.ProxyManager(
num_pools=pools_size,
maxsize=maxsize,
@@ -290,3 +292,55 @@ class RESTClientObject(object):
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
+
+# end of class RESTClientObject
+def is_ipv4(target):
+ """ Test if IPv4 address or not
+ """
+ try:
+ chk = ipaddress.IPv4Address(target)
+ return True
+ except ipaddress.AddressValueError:
+ return False
+
+def in_ipv4net(target, net):
+ """ Test if target belongs to given IPv4 network
+ """
+ try:
+ nw = ipaddress.IPv4Network(net)
+ ip = ipaddress.IPv4Address(target)
+ if ip in nw:
+ return True
+ return False
+ except ipaddress.AddressValueError:
+ return False
+ except ipaddress.NetmaskValueError:
+ return False
+
+def should_bypass_proxies(url, no_proxy=None):
+ """ Yet another requests.should_bypass_proxies
+ Test if proxies should not be used for a particular url.
+ """
+
+ parsed = urlparse(url)
+
+ # special cases
+ if parsed.hostname in [None, '']:
+ return True
+
+ # special cases
+ if no_proxy in [None , '']:
+ return False
+ if no_proxy == '*':
+ return True
+
+ no_proxy = no_proxy.lower().replace(' ','');
+ entries = (
+ host for host in no_proxy.split(',') if host
+ )
+
+ if is_ipv4(parsed.hostname):
+ for item in entries:
+ if in_ipv4net(parsed.hostname, item):
+ return True
+ return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} )
diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_extra_pool_config_options.py b/samples/openapi3/client/petstore/python/tests_manual/test_extra_pool_config_options.py
index 5bf6b989ebe..9e49b9e71ba 100644
--- a/samples/openapi3/client/petstore/python/tests_manual/test_extra_pool_config_options.py
+++ b/samples/openapi3/client/petstore/python/tests_manual/test_extra_pool_config_options.py
@@ -48,9 +48,9 @@ class TestExtraOptionsForPools(unittest.TestCase):
socket_options = ["extra", "socket", "options"]
- config = petstore_api.Configuration(host="HOST")
+ config = petstore_api.Configuration(host="http://somehost.local:8080")
config.socket_options = socket_options
- config.proxy = True
+ config.proxy = "http://proxy.local:8080/"
with patch("petstore_api.rest.urllib3.ProxyManager", StubProxyManager):
api_client = petstore_api.ApiClient(config)
From d1089d785c1982c7a50e0c95e9b723a44e1e1d2d Mon Sep 17 00:00:00 2001
From: rudolficzek
Date: Tue, 26 Oct 2021 12:49:18 +0100
Subject: [PATCH 02/25] fix import mappings for service in angular typescript
(#10644)
* fix import mappings for service in angular typescript
* add unit test
* regenerated samples
---
.../languages/TypeScriptAngularClientCodegen.java | 3 ++-
.../resources/typescript-angular/api.service.mustache | 2 +-
.../TypeScriptAngularClientCodegenTest.java | 11 ++++++++++-
.../builds/default/api/pet.service.ts | 4 ++--
.../builds/default/api/store.service.ts | 2 +-
.../builds/default/api/user.service.ts | 2 +-
.../builds/with-npm/api/pet.service.ts | 4 ++--
.../builds/with-npm/api/store.service.ts | 2 +-
.../builds/with-npm/api/user.service.ts | 2 +-
.../builds/default/api/default.service.ts | 2 +-
.../builds/default/api/pet.service.ts | 4 ++--
.../builds/default/api/store.service.ts | 2 +-
.../builds/default/api/user.service.ts | 2 +-
.../builds/with-npm/api/pet.service.ts | 4 ++--
.../builds/with-npm/api/store.service.ts | 2 +-
.../builds/with-npm/api/user.service.ts | 2 +-
.../builds/default/api/pet.service.ts | 4 ++--
.../builds/default/api/store.service.ts | 2 +-
.../builds/default/api/user.service.ts | 2 +-
.../builds/with-npm/api/pet.service.ts | 4 ++--
.../builds/with-npm/api/store.service.ts | 2 +-
.../builds/with-npm/api/user.service.ts | 2 +-
.../builds/default/api/pet.service.ts | 4 ++--
.../builds/default/api/store.service.ts | 2 +-
.../builds/default/api/user.service.ts | 2 +-
.../builds/with-npm/api/pet.service.ts | 4 ++--
.../builds/with-npm/api/store.service.ts | 2 +-
.../builds/with-npm/api/user.service.ts | 2 +-
.../builds/default/api/pet.service.ts | 4 ++--
.../builds/default/api/store.service.ts | 2 +-
.../builds/default/api/user.service.ts | 2 +-
.../builds/with-npm/api/pet.service.ts | 4 ++--
.../builds/with-npm/api/store.service.ts | 2 +-
.../builds/with-npm/api/user.service.ts | 2 +-
.../builds/default/api/pet.service.ts | 4 ++--
.../builds/default/api/store.service.ts | 2 +-
.../builds/default/api/user.service.ts | 2 +-
.../builds/with-npm/api/pet.service.ts | 4 ++--
.../builds/with-npm/api/store.service.ts | 2 +-
.../builds/with-npm/api/user.service.ts | 2 +-
.../builds/default/api/pet.service.ts | 4 ++--
.../builds/default/api/store.service.ts | 2 +-
.../builds/default/api/user.service.ts | 2 +-
.../builds/with-npm/api/pet.service.ts | 4 ++--
.../builds/with-npm/api/store.service.ts | 2 +-
.../builds/with-npm/api/user.service.ts | 2 +-
.../single-request-parameter/api/pet.service.ts | 4 ++--
.../single-request-parameter/api/store.service.ts | 2 +-
.../single-request-parameter/api/user.service.ts | 2 +-
.../builds/with-npm/api/pet.service.ts | 4 ++--
.../builds/with-npm/api/store.service.ts | 2 +-
.../builds/with-npm/api/user.service.ts | 2 +-
.../with-prefixed-module-name/api/pet.service.ts | 4 ++--
.../with-prefixed-module-name/api/store.service.ts | 2 +-
.../with-prefixed-module-name/api/user.service.ts | 2 +-
.../builds/default/api/pet.service.ts | 4 ++--
.../builds/default/api/store.service.ts | 2 +-
.../builds/default/api/user.service.ts | 2 +-
.../builds/default/api/pet.service.ts | 4 ++--
.../builds/default/api/store.service.ts | 2 +-
.../builds/default/api/user.service.ts | 2 +-
.../builds/with-npm/api/pet.service.ts | 4 ++--
.../builds/with-npm/api/store.service.ts | 2 +-
.../builds/with-npm/api/user.service.ts | 2 +-
64 files changed, 94 insertions(+), 84 deletions(-)
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java
index a00b28395f6..f2c8033a233 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java
@@ -44,6 +44,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
public static enum PROVIDED_IN_LEVEL {none, root, any, platform}
private static final String DEFAULT_IMPORT_PREFIX = "./";
+ private static final String DEFAULT_MODEL_IMPORT_DIRECTORY_PREFIX = "../";
public static final String NPM_REPOSITORY = "npmRepository";
public static final String WITH_INTERFACES = "withInterfaces";
@@ -634,7 +635,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
if (importMapping.containsKey(name)) {
return importMapping.get(name);
}
- return modelPackage() + "/" + toModelFilename(name).substring(DEFAULT_IMPORT_PREFIX.length());
+ return DEFAULT_MODEL_IMPORT_DIRECTORY_PREFIX + modelPackage() + "/" + toModelFilename(name).substring(DEFAULT_IMPORT_PREFIX.length());
}
public String getNpmRepository() {
diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache
index 02c52d23355..cc7f28eee00 100644
--- a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache
@@ -9,7 +9,7 @@ import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
{{#imports}}
-import { {{classname}} } from '../model/models';
+import { {{ classname }} } from '{{ filename }}';
{{/imports}}
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientCodegenTest.java
index 07e2216710b..e5a76bd02a3 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientCodegenTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientCodegenTest.java
@@ -228,7 +228,7 @@ public class TypeScriptAngularClientCodegenTest {
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("test", schema);
codegen.setOpenAPI(openAPI);
- Assert.assertEquals(codegen.toModelImport(modelName), "model/foo-response-links");
+ Assert.assertEquals(codegen.toModelImport(modelName), "../model/foo-response-links");
Assert.assertEquals(codegen.toModelFilename(modelName), "./foo-response-links");
}
@@ -258,4 +258,13 @@ public class TypeScriptAngularClientCodegenTest {
Assert.assertEquals(codegen.toParamName("valid_id"), "ValidId");
Assert.assertEquals(codegen.toParamName("illegal-id+"), "IllegalId");
}
+
+ @Test
+ public void testCorrectlyProducesImportsWithImportMapping() {
+ TypeScriptAngularClientCodegen codegen = new TypeScriptAngularClientCodegen();
+ final String importedModel = "SharedApiModel";
+ final String importName = "@lib/custom/model";
+ codegen.importMapping().put(importedModel, importName);
+ Assert.assertEquals(codegen.toModelImport(importedModel), importName);
+ }
}
diff --git a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/pet.service.ts
index 800853664a0..23bbf686609 100644
--- a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/store.service.ts
index 1397ffd2d02..43135a4b747 100644
--- a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/user.service.ts
index 9809f730029..4326037967a 100644
--- a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/pet.service.ts
index 800853664a0..23bbf686609 100644
--- a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/store.service.ts
index 1397ffd2d02..43135a4b747 100644
--- a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/user.service.ts
index 9809f730029..4326037967a 100644
--- a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v11-oneOf/builds/default/api/default.service.ts b/samples/client/petstore/typescript-angular-v11-oneOf/builds/default/api/default.service.ts
index ac873acd096..c21facfef1f 100644
--- a/samples/client/petstore/typescript-angular-v11-oneOf/builds/default/api/default.service.ts
+++ b/samples/client/petstore/typescript-angular-v11-oneOf/builds/default/api/default.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Fruit } from '../model/models';
+import { Fruit } from '../model/fruit';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/pet.service.ts
index 800853664a0..23bbf686609 100644
--- a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/store.service.ts
index 1397ffd2d02..43135a4b747 100644
--- a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/user.service.ts
index 9809f730029..4326037967a 100644
--- a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/pet.service.ts
index 800853664a0..23bbf686609 100644
--- a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/store.service.ts
index 1397ffd2d02..43135a4b747 100644
--- a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/user.service.ts
index 9809f730029..4326037967a 100644
--- a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/pet.service.ts
index d8009ed719c..a3bb80fd1c3 100644
--- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/store.service.ts
index 2f3ced393cc..ba1af51f2af 100644
--- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/user.service.ts
index a1daecfe0d5..8f5fdccbb24 100644
--- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/pet.service.ts
index d8009ed719c..a3bb80fd1c3 100644
--- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/store.service.ts
index 2f3ced393cc..ba1af51f2af 100644
--- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/user.service.ts
index a1daecfe0d5..8f5fdccbb24 100644
--- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts
index 6307beedbe6..3f19c7121aa 100644
--- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts
index df5eb10d6dd..c1e177bce56 100644
--- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts
index 22cdfe1be90..3f13dc90e17 100644
--- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts
index 6307beedbe6..3f19c7121aa 100644
--- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts
index df5eb10d6dd..c1e177bce56 100644
--- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts
index 22cdfe1be90..3f13dc90e17 100644
--- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts
index 800853664a0..23bbf686609 100644
--- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts
index 1397ffd2d02..43135a4b747 100644
--- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts
index 9809f730029..4326037967a 100644
--- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts
index 800853664a0..23bbf686609 100644
--- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts
index 1397ffd2d02..43135a4b747 100644
--- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts
index 9809f730029..4326037967a 100644
--- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts
index 6307beedbe6..3f19c7121aa 100644
--- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts
index df5eb10d6dd..c1e177bce56 100644
--- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts
index 22cdfe1be90..3f13dc90e17 100644
--- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts
index 6307beedbe6..3f19c7121aa 100644
--- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts
index df5eb10d6dd..c1e177bce56 100644
--- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts
index 22cdfe1be90..3f13dc90e17 100644
--- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts
index 800853664a0..23bbf686609 100644
--- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts
index 1397ffd2d02..43135a4b747 100644
--- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts
index 9809f730029..4326037967a 100644
--- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts
index 800853664a0..23bbf686609 100644
--- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts
index 1397ffd2d02..43135a4b747 100644
--- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts
index 9809f730029..4326037967a 100644
--- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts
index e0b1b6f5c7e..4c18dd863be 100644
--- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts
index 1bfb6c2e277..37fc3bd68bc 100644
--- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts
index 971e87a39ae..304be84784b 100644
--- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts
index 800853664a0..23bbf686609 100644
--- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts
index 1397ffd2d02..43135a4b747 100644
--- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts
index 9809f730029..4326037967a 100644
--- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts
index 2d8ef08dd39..209bc5dd588 100644
--- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { PetStoreConfiguration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts
index ac3e175914e..bd2dd3768e6 100644
--- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { PetStoreConfiguration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts
index 8c07bd3cf32..aebbfb3c47b 100644
--- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { PetStoreConfiguration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/pet.service.ts
index 014e9610fd7..60cd6a36f29 100644
--- a/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/store.service.ts
index ff7748156a8..115d9339268 100644
--- a/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/user.service.ts
index 21931307519..09835bf872e 100644
--- a/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/pet.service.ts
index 800853664a0..23bbf686609 100644
--- a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/store.service.ts
index 1397ffd2d02..43135a4b747 100644
--- a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/user.service.ts
index 9809f730029..4326037967a 100644
--- a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/pet.service.ts
index 800853664a0..23bbf686609 100644
--- a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/pet.service.ts
@@ -18,8 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { ApiResponse } from '../model/models';
-import { Pet } from '../model/models';
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/store.service.ts
index 1397ffd2d02..43135a4b747 100644
--- a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/store.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { Order } from '../model/models';
+import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/user.service.ts
index 9809f730029..4326037967a 100644
--- a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/user.service.ts
@@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
-import { User } from '../model/models';
+import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
From 01a4569995659908f53281cb10895618a7b6110b Mon Sep 17 00:00:00 2001
From: cyangle
Date: Tue, 26 Oct 2021 11:21:19 -0500
Subject: [PATCH 03/25] Remove .rspec and .rubycop.yml from crystal client
(#10701)
---
.../src/main/resources/crystal/rspec.mustache | 2 -
.../main/resources/crystal/rubocop.mustache | 148 ------------------
samples/client/petstore/crystal/.rspec | 2 -
samples/client/petstore/crystal/.rubocop.yml | 148 ------------------
4 files changed, 300 deletions(-)
delete mode 100644 modules/openapi-generator/src/main/resources/crystal/rspec.mustache
delete mode 100644 modules/openapi-generator/src/main/resources/crystal/rubocop.mustache
delete mode 100644 samples/client/petstore/crystal/.rspec
delete mode 100644 samples/client/petstore/crystal/.rubocop.yml
diff --git a/modules/openapi-generator/src/main/resources/crystal/rspec.mustache b/modules/openapi-generator/src/main/resources/crystal/rspec.mustache
deleted file mode 100644
index 83e16f80447..00000000000
--- a/modules/openapi-generator/src/main/resources/crystal/rspec.mustache
+++ /dev/null
@@ -1,2 +0,0 @@
---color
---require spec_helper
diff --git a/modules/openapi-generator/src/main/resources/crystal/rubocop.mustache b/modules/openapi-generator/src/main/resources/crystal/rubocop.mustache
deleted file mode 100644
index d32b2b1cdab..00000000000
--- a/modules/openapi-generator/src/main/resources/crystal/rubocop.mustache
+++ /dev/null
@@ -1,148 +0,0 @@
-# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license)
-# Automatically generated by OpenAPI Generator (https://openapi-generator.tech)
-AllCops:
- TargetRubyVersion: 2.4
- # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
- # to ignore them, so only the ones explicitly set in this file are enabled.
- DisabledByDefault: true
- Exclude:
- - '**/templates/**/*'
- - '**/vendor/**/*'
- - 'actionpack/lib/action_dispatch/journey/parser.rb'
-
-# Prefer &&/|| over and/or.
-Style/AndOr:
- Enabled: true
-
-# Align `when` with `case`.
-Layout/CaseIndentation:
- Enabled: true
-
-# Align comments with method definitions.
-Layout/CommentIndentation:
- Enabled: true
-
-Layout/ElseAlignment:
- Enabled: true
-
-Layout/EmptyLineAfterMagicComment:
- Enabled: true
-
-# In a regular class definition, no empty lines around the body.
-Layout/EmptyLinesAroundClassBody:
- Enabled: true
-
-# In a regular method definition, no empty lines around the body.
-Layout/EmptyLinesAroundMethodBody:
- Enabled: true
-
-# In a regular module definition, no empty lines around the body.
-Layout/EmptyLinesAroundModuleBody:
- Enabled: true
-
-Layout/FirstArgumentIndentation:
- Enabled: true
-
-# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
-Style/HashSyntax:
- Enabled: false
-
-# Method definitions after `private` or `protected` isolated calls need one
-# extra level of indentation.
-Layout/IndentationConsistency:
- Enabled: true
- EnforcedStyle: indented_internal_methods
-
-# Two spaces, no tabs (for indentation).
-Layout/IndentationWidth:
- Enabled: true
-
-Layout/LeadingCommentSpace:
- Enabled: true
-
-Layout/SpaceAfterColon:
- Enabled: true
-
-Layout/SpaceAfterComma:
- Enabled: true
-
-Layout/SpaceAroundEqualsInParameterDefault:
- Enabled: true
-
-Layout/SpaceAroundKeyword:
- Enabled: true
-
-Layout/SpaceAroundOperators:
- Enabled: true
-
-Layout/SpaceBeforeComma:
- Enabled: true
-
-Layout/SpaceBeforeFirstArg:
- Enabled: true
-
-Style/DefWithParentheses:
- Enabled: true
-
-# Defining a method with parameters needs parentheses.
-Style/MethodDefParentheses:
- Enabled: true
-
-Style/FrozenStringLiteralComment:
- Enabled: false
- EnforcedStyle: always
-
-# Use `foo {}` not `foo{}`.
-Layout/SpaceBeforeBlockBraces:
- Enabled: true
-
-# Use `foo { bar }` not `foo {bar}`.
-Layout/SpaceInsideBlockBraces:
- Enabled: true
-
-# Use `{ a: 1 }` not `{a:1}`.
-Layout/SpaceInsideHashLiteralBraces:
- Enabled: true
-
-Layout/SpaceInsideParens:
- Enabled: true
-
-# Check quotes usage according to lint rule below.
-#Style/StringLiterals:
-# Enabled: true
-# EnforcedStyle: single_quotes
-
-# Detect hard tabs, no hard tabs.
-Layout/IndentationStyle:
- Enabled: true
-
-# Blank lines should not have any spaces.
-Layout/TrailingEmptyLines:
- Enabled: true
-
-# No trailing whitespace.
-Layout/TrailingWhitespace:
- Enabled: false
-
-# Use quotes for string literals when they are enough.
-Style/RedundantPercentQ:
- Enabled: true
-
-# Align `end` with the matching keyword or starting expression except for
-# assignments, where it should be aligned with the LHS.
-Layout/EndAlignment:
- Enabled: true
- EnforcedStyleAlignWith: variable
- AutoCorrect: true
-
-# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
-Lint/RequireParentheses:
- Enabled: true
-
-Style/RedundantReturn:
- Enabled: true
- AllowMultipleReturnValues: true
-
-Style/Semicolon:
- Enabled: true
- AllowAsExpressionSeparator: true
diff --git a/samples/client/petstore/crystal/.rspec b/samples/client/petstore/crystal/.rspec
deleted file mode 100644
index 83e16f80447..00000000000
--- a/samples/client/petstore/crystal/.rspec
+++ /dev/null
@@ -1,2 +0,0 @@
---color
---require spec_helper
diff --git a/samples/client/petstore/crystal/.rubocop.yml b/samples/client/petstore/crystal/.rubocop.yml
deleted file mode 100644
index d32b2b1cdab..00000000000
--- a/samples/client/petstore/crystal/.rubocop.yml
+++ /dev/null
@@ -1,148 +0,0 @@
-# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license)
-# Automatically generated by OpenAPI Generator (https://openapi-generator.tech)
-AllCops:
- TargetRubyVersion: 2.4
- # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
- # to ignore them, so only the ones explicitly set in this file are enabled.
- DisabledByDefault: true
- Exclude:
- - '**/templates/**/*'
- - '**/vendor/**/*'
- - 'actionpack/lib/action_dispatch/journey/parser.rb'
-
-# Prefer &&/|| over and/or.
-Style/AndOr:
- Enabled: true
-
-# Align `when` with `case`.
-Layout/CaseIndentation:
- Enabled: true
-
-# Align comments with method definitions.
-Layout/CommentIndentation:
- Enabled: true
-
-Layout/ElseAlignment:
- Enabled: true
-
-Layout/EmptyLineAfterMagicComment:
- Enabled: true
-
-# In a regular class definition, no empty lines around the body.
-Layout/EmptyLinesAroundClassBody:
- Enabled: true
-
-# In a regular method definition, no empty lines around the body.
-Layout/EmptyLinesAroundMethodBody:
- Enabled: true
-
-# In a regular module definition, no empty lines around the body.
-Layout/EmptyLinesAroundModuleBody:
- Enabled: true
-
-Layout/FirstArgumentIndentation:
- Enabled: true
-
-# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
-Style/HashSyntax:
- Enabled: false
-
-# Method definitions after `private` or `protected` isolated calls need one
-# extra level of indentation.
-Layout/IndentationConsistency:
- Enabled: true
- EnforcedStyle: indented_internal_methods
-
-# Two spaces, no tabs (for indentation).
-Layout/IndentationWidth:
- Enabled: true
-
-Layout/LeadingCommentSpace:
- Enabled: true
-
-Layout/SpaceAfterColon:
- Enabled: true
-
-Layout/SpaceAfterComma:
- Enabled: true
-
-Layout/SpaceAroundEqualsInParameterDefault:
- Enabled: true
-
-Layout/SpaceAroundKeyword:
- Enabled: true
-
-Layout/SpaceAroundOperators:
- Enabled: true
-
-Layout/SpaceBeforeComma:
- Enabled: true
-
-Layout/SpaceBeforeFirstArg:
- Enabled: true
-
-Style/DefWithParentheses:
- Enabled: true
-
-# Defining a method with parameters needs parentheses.
-Style/MethodDefParentheses:
- Enabled: true
-
-Style/FrozenStringLiteralComment:
- Enabled: false
- EnforcedStyle: always
-
-# Use `foo {}` not `foo{}`.
-Layout/SpaceBeforeBlockBraces:
- Enabled: true
-
-# Use `foo { bar }` not `foo {bar}`.
-Layout/SpaceInsideBlockBraces:
- Enabled: true
-
-# Use `{ a: 1 }` not `{a:1}`.
-Layout/SpaceInsideHashLiteralBraces:
- Enabled: true
-
-Layout/SpaceInsideParens:
- Enabled: true
-
-# Check quotes usage according to lint rule below.
-#Style/StringLiterals:
-# Enabled: true
-# EnforcedStyle: single_quotes
-
-# Detect hard tabs, no hard tabs.
-Layout/IndentationStyle:
- Enabled: true
-
-# Blank lines should not have any spaces.
-Layout/TrailingEmptyLines:
- Enabled: true
-
-# No trailing whitespace.
-Layout/TrailingWhitespace:
- Enabled: false
-
-# Use quotes for string literals when they are enough.
-Style/RedundantPercentQ:
- Enabled: true
-
-# Align `end` with the matching keyword or starting expression except for
-# assignments, where it should be aligned with the LHS.
-Layout/EndAlignment:
- Enabled: true
- EnforcedStyleAlignWith: variable
- AutoCorrect: true
-
-# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
-Lint/RequireParentheses:
- Enabled: true
-
-Style/RedundantReturn:
- Enabled: true
- AllowMultipleReturnValues: true
-
-Style/Semicolon:
- Enabled: true
- AllowAsExpressionSeparator: true
From f1ab3edbc0660e46237ba8f5d2ffccc6278e7cd0 Mon Sep 17 00:00:00 2001
From: Peter Leibiger
Date: Tue, 26 Oct 2021 18:33:58 +0200
Subject: [PATCH 04/25] [dart] Fix pub server URL (#10695)
* replace private pub server with official pub server URL
---
.../serialization/built_value/class.mustache | 2 +-
.../pubspec.lock | 116 ++++++++---------
.../pubspec.lock | 118 +++++++++---------
.../petstore/dart2/petstore/pubspec.lock | 116 ++++++++---------
4 files changed, 176 insertions(+), 176 deletions(-)
diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache
index 11bc668b902..b144bd50495 100644
--- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache
+++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache
@@ -106,7 +106,7 @@ class _${{classname}}Serializer implements StructuredSerializer<{{classname}}> {
{{/isContainer}}
{{#isModel}}
{{#isPrimitiveType}}
- {{! These are models that have nee manually marked as primitve via generator param. }}
+ {{! These are models that have nee manually marked as primitive via generator param. }}
result.{{{name}}} = valueDes;
{{/isPrimitiveType}}
{{^isPrimitiveType}}
diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/pubspec.lock b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/pubspec.lock
index d551818e23c..fa4f795327d 100644
--- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/pubspec.lock
+++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/pubspec.lock
@@ -5,224 +5,224 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "21.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
args:
dependency: transitive
description:
name: args
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
async:
dependency: transitive
description:
name: async
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.7.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
build:
dependency: transitive
description:
name: build
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
built_collection:
dependency: "direct dev"
description:
name: built_collection
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
built_value:
dependency: "direct dev"
description:
name: built_value
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "8.1.0"
charcode:
dependency: transitive
description:
name: charcode
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
cli_util:
dependency: transitive
description:
name: cli_util
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
code_builder:
dependency: transitive
description:
name: code_builder
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
collection:
dependency: transitive
description:
name: collection
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
convert:
dependency: transitive
description:
name: convert
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
coverage:
dependency: transitive
description:
name: coverage
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
crypto:
dependency: transitive
description:
name: crypto
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
dart_style:
dependency: transitive
description:
name: dart_style
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
dio:
dependency: "direct dev"
description:
name: dio
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
file:
dependency: transitive
description:
name: file
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "6.1.1"
fixnum:
dependency: transitive
description:
name: fixnum
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
glob:
dependency: transitive
description:
name: glob
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
http_mock_adapter:
dependency: "direct dev"
description:
name: http_mock_adapter
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
http_parser:
dependency: transitive
description:
name: http_parser
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
io:
dependency: transitive
description:
name: io
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
js:
dependency: transitive
description:
name: js
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
logging:
dependency: transitive
description:
name: logging
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
matcher:
dependency: transitive
description:
name: matcher
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
mime:
dependency: transitive
description:
name: mime
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
mockito:
dependency: "direct dev"
description:
name: mockito
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "5.0.11"
node_preamble:
dependency: transitive
description:
name: node_preamble
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
openapi:
@@ -236,182 +236,182 @@ packages:
dependency: transitive
description:
name: package_config
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
path:
dependency: transitive
description:
name: path
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
pedantic:
dependency: transitive
description:
name: pedantic
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
pool:
dependency: transitive
description:
name: pool
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
pub_semver:
dependency: transitive
description:
name: pub_semver
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
shelf:
dependency: transitive
description:
name: shelf
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.1.4"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
shelf_static:
dependency: transitive
description:
name: shelf_static
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
source_gen:
dependency: transitive
description:
name: source_gen
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
source_map_stack_trace:
dependency: transitive
description:
name: source_map_stack_trace
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
source_maps:
dependency: transitive
description:
name: source_maps
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.10.10"
source_span:
dependency: transitive
description:
name: source_span
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
test:
dependency: "direct dev"
description:
name: test
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.17.4"
test_api:
dependency: transitive
description:
name: test_api
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.4.0"
test_core:
dependency: transitive
description:
name: test_core
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.3.24"
typed_data:
dependency: transitive
description:
name: typed_data
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
vm_service:
dependency: transitive
description:
name: vm_service
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "6.2.0"
watcher:
dependency: transitive
description:
name: watcher
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
webkit_inspection_protocol:
dependency: transitive
description:
name: webkit_inspection_protocol
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
yaml:
dependency: transitive
description:
name: yaml
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
sdks:
diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.lock b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.lock
index 4355ed26f68..f23a0ab8a16 100644
--- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.lock
+++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.lock
@@ -5,231 +5,231 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "12.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.40.6"
args:
dependency: transitive
description:
name: args
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
async:
dependency: transitive
description:
name: async
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
built_collection:
dependency: "direct dev"
description:
name: built_collection
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "4.3.2"
built_value:
dependency: "direct dev"
description:
name: built_value
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "7.1.0"
charcode:
dependency: transitive
description:
name: charcode
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
cli_util:
dependency: transitive
description:
name: cli_util
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
clock:
dependency: transitive
description:
name: clock
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
convert:
dependency: transitive
description:
name: convert
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
coverage:
dependency: transitive
description:
name: coverage
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.14.2"
crypto:
dependency: transitive
description:
name: crypto
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.5"
dio:
dependency: "direct dev"
description:
name: dio
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "3.0.10"
file:
dependency: transitive
description:
name: file
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "5.2.1"
fixnum:
dependency: transitive
description:
name: fixnum
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.10.11"
glob:
dependency: transitive
description:
name: glob
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
http:
dependency: transitive
description:
name: http
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.12.2"
http_mock_adapter:
dependency: "direct dev"
description:
name: http_mock_adapter
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.1.6"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
http_parser:
dependency: transitive
description:
name: http_parser
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
intl:
dependency: transitive
description:
name: intl
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
io:
dependency: transitive
description:
name: io
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.3.5"
js:
dependency: transitive
description:
name: js
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
logging:
dependency: transitive
description:
name: logging
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.11.4"
matcher:
dependency: transitive
description:
name: matcher
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.12.9"
meta:
dependency: transitive
description:
name: meta
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
mime:
dependency: transitive
description:
name: mime
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
mockito:
dependency: "direct overridden"
description:
name: mockito
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "4.1.1"
node_interop:
dependency: transitive
description:
name: node_interop
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
node_io:
dependency: transitive
description:
name: node_io
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
node_preamble:
dependency: transitive
description:
name: node_preamble
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.4.13"
openapi:
@@ -243,182 +243,182 @@ packages:
dependency: transitive
description:
name: package_config
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
path:
dependency: transitive
description:
name: path
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
pedantic:
dependency: transitive
description:
name: pedantic
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
pool:
dependency: transitive
description:
name: pool
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
pub_semver:
dependency: transitive
description:
name: pub_semver
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
quiver:
dependency: transitive
description:
name: quiver
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.5"
shelf:
dependency: transitive
description:
name: shelf
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.7.9"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
shelf_static:
dependency: transitive
description:
name: shelf_static
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.2.9+2"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.2.4+1"
source_map_stack_trace:
dependency: transitive
description:
name: source_map_stack_trace
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
source_maps:
dependency: transitive
description:
name: source_maps
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.10.10"
source_span:
dependency: transitive
description:
name: source_span
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
test:
dependency: "direct dev"
description:
name: test
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.15.5"
test_api:
dependency: transitive
description:
name: test_api
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.2.18+1"
test_core:
dependency: transitive
description:
name: test_core
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.3.11+2"
typed_data:
dependency: transitive
description:
name: typed_data
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
vm_service:
dependency: transitive
description:
name: vm_service
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "4.2.0"
watcher:
dependency: transitive
description:
name: watcher
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7+15"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
webkit_inspection_protocol:
dependency: transitive
description:
name: webkit_inspection_protocol
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.7.5"
yaml:
dependency: transitive
description:
name: yaml
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
sdks:
diff --git a/samples/openapi3/client/petstore/dart2/petstore/pubspec.lock b/samples/openapi3/client/petstore/dart2/petstore/pubspec.lock
index 9b351ff283a..dd5bbc89254 100644
--- a/samples/openapi3/client/petstore/dart2/petstore/pubspec.lock
+++ b/samples/openapi3/client/petstore/dart2/petstore/pubspec.lock
@@ -5,224 +5,224 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "14.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.41.2"
args:
dependency: transitive
description:
name: args
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
async:
dependency: transitive
description:
name: async
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.7.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
build:
dependency: transitive
description:
name: build
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.6.2"
built_collection:
dependency: transitive
description:
name: built_collection
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
built_value:
dependency: transitive
description:
name: built_value
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "8.1.1"
charcode:
dependency: transitive
description:
name: charcode
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
cli_util:
dependency: transitive
description:
name: cli_util
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.3.3"
clock:
dependency: transitive
description:
name: clock
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
code_builder:
dependency: transitive
description:
name: code_builder
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "3.7.0"
collection:
dependency: "direct dev"
description:
name: collection
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
convert:
dependency: transitive
description:
name: convert
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
coverage:
dependency: transitive
description:
name: coverage
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.15.2"
crypto:
dependency: transitive
description:
name: crypto
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
dart_style:
dependency: transitive
description:
name: dart_style
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.3.12"
file:
dependency: transitive
description:
name: file
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "6.1.2"
fixnum:
dependency: transitive
description:
name: fixnum
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
glob:
dependency: transitive
description:
name: glob
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
http:
dependency: "direct dev"
description:
name: http
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.13.3"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
http_parser:
dependency: transitive
description:
name: http_parser
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
intl:
dependency: transitive
description:
name: intl
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
io:
dependency: transitive
description:
name: io
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
js:
dependency: transitive
description:
name: js
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
logging:
dependency: transitive
description:
name: logging
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
matcher:
dependency: transitive
description:
name: matcher
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
meta:
dependency: "direct dev"
description:
name: meta
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
mime:
dependency: transitive
description:
name: mime
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
mockito:
dependency: "direct dev"
description:
name: mockito
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "4.1.4"
node_preamble:
dependency: transitive
description:
name: node_preamble
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.4.13"
openapi:
@@ -236,182 +236,182 @@ packages:
dependency: transitive
description:
name: package_config
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
path:
dependency: transitive
description:
name: path
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
pedantic:
dependency: transitive
description:
name: pedantic
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.11.1"
pool:
dependency: transitive
description:
name: pool
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
pub_semver:
dependency: transitive
description:
name: pub_semver
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
shelf:
dependency: transitive
description:
name: shelf
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
shelf_static:
dependency: transitive
description:
name: shelf_static
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
source_gen:
dependency: transitive
description:
name: source_gen
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.9.10+3"
source_map_stack_trace:
dependency: transitive
description:
name: source_map_stack_trace
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
source_maps:
dependency: transitive
description:
name: source_maps
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.10.10"
source_span:
dependency: transitive
description:
name: source_span
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
test:
dependency: "direct dev"
description:
name: test
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.16.5"
test_api:
dependency: transitive
description:
name: test_api
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19"
test_core:
dependency: transitive
description:
name: test_core
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "0.3.15"
typed_data:
dependency: transitive
description:
name: typed_data
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
vm_service:
dependency: transitive
description:
name: vm_service
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "6.2.0"
watcher:
dependency: transitive
description:
name: watcher
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
webkit_inspection_protocol:
dependency: transitive
description:
name: webkit_inspection_protocol
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
yaml:
dependency: transitive
description:
name: yaml
- url: "https://pub.intern.sk"
+ url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
sdks:
From 8d490835b7b001f365bc9e6318ef11efd4367f58 Mon Sep 17 00:00:00 2001
From: Justin Black
Date: Tue, 26 Oct 2021 09:45:21 -0700
Subject: [PATCH 05/25] Adds setPrettyPrint and the reslver
MethodValueResolver.INSTANCE (#10683)
---
.../codegen/templating/HandlebarsEngineAdapter.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/HandlebarsEngineAdapter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/HandlebarsEngineAdapter.java
index 54d27dc47a7..ef9178e610d 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/HandlebarsEngineAdapter.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/HandlebarsEngineAdapter.java
@@ -23,6 +23,7 @@ import com.github.jknack.handlebars.Template;
import com.github.jknack.handlebars.context.FieldValueResolver;
import com.github.jknack.handlebars.context.JavaBeanValueResolver;
import com.github.jknack.handlebars.context.MapValueResolver;
+import com.github.jknack.handlebars.context.MethodValueResolver;
import com.github.jknack.handlebars.helper.ConditionalHelpers;
import com.github.jknack.handlebars.helper.StringHelpers;
import com.github.jknack.handlebars.io.AbstractTemplateLoader;
@@ -46,6 +47,7 @@ public class HandlebarsEngineAdapter extends AbstractTemplatingEngineAdapter {
// We use this as a simple lookup for valid file name extensions. This adapter will inspect .mustache (built-in) and infer the relevant handlebars filename
private final String[] canCompileFromExtensions = new String[]{".handlebars",".hbs",".mustache"};
private boolean infiniteLoops = false;
+ private boolean prettyPrint = false;
/**
* Provides an identifier used to load the adapter. This could be a name, uuid, or any other string.
@@ -71,7 +73,8 @@ public class HandlebarsEngineAdapter extends AbstractTemplatingEngineAdapter {
.resolver(
MapValueResolver.INSTANCE,
JavaBeanValueResolver.INSTANCE,
- FieldValueResolver.INSTANCE)
+ FieldValueResolver.INSTANCE,
+ MethodValueResolver.INSTANCE)
.build();
Handlebars handlebars = new Handlebars(loader);
@@ -84,6 +87,7 @@ public class HandlebarsEngineAdapter extends AbstractTemplatingEngineAdapter {
handlebars.registerHelpers(ConditionalHelpers.class);
handlebars.registerHelpers(org.openapitools.codegen.templating.handlebars.StringHelpers.class);
handlebars.setInfiniteLoops(infiniteLoops);
+ handlebars.setPrettyPrint(prettyPrint);
Template tmpl = handlebars.compile(templateFile);
return tmpl.apply(context);
}
@@ -134,5 +138,9 @@ public class HandlebarsEngineAdapter extends AbstractTemplatingEngineAdapter {
this.infiniteLoops = infiniteLoops;
return this;
}
+
+ public void setPrettyPrint(boolean prettyPrint) {
+ this.prettyPrint = prettyPrint;
+ }
}
From 3a667784acab58d5107daf557cd1ba7bb679e0a1 Mon Sep 17 00:00:00 2001
From: Justin Black
Date: Tue, 26 Oct 2021 12:49:32 -0700
Subject: [PATCH 06/25] Adds ComposedSchema to store schema composed schemas
(#10653)
* Adds ComposedSchema and the ability to set it in CodegenModel and CodegenProperty
* Adds ComposedSchemas class and adds getters and setters for it in schema implementors
* Adds and uses getComposedSchemas
* Makes method private
* Uses setComposedSchemas for CodegenParameter and CodegenResponse
* Samples regeneratoed, tweaked string representation
* Removes null default
* Removes anyOfProps, oneOfProps, allOfProps
* Removes unneeded line
---
.../codegen/CodegenComposedSchemas.java | 66 +++++++++++++++++++
.../openapitools/codegen/CodegenModel.java | 28 ++++----
.../codegen/CodegenParameter.java | 18 ++++-
.../openapitools/codegen/CodegenProperty.java | 18 ++++-
.../openapitools/codegen/CodegenResponse.java | 15 ++++-
.../openapitools/codegen/DefaultCodegen.java | 44 +++++++++----
.../IJsonSchemaValidationProperties.java | 5 ++
.../handler/PathHandlerInterface.java | 4 +-
8 files changed, 168 insertions(+), 30 deletions(-)
create mode 100644 modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenComposedSchemas.java
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenComposedSchemas.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenComposedSchemas.java
new file mode 100644
index 00000000000..f801853dafc
--- /dev/null
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenComposedSchemas.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openapitools.codegen;
+
+import java.util.*;
+
+public class CodegenComposedSchemas {
+ private List allOf;
+ private List oneOf;
+ private List anyOf;
+
+ public CodegenComposedSchemas(List allOf, List oneOf, List anyOf) {
+ this.allOf = allOf;
+ this.oneOf = oneOf;
+ this.anyOf = anyOf;
+ }
+
+ public List getAllOf() {
+ return allOf;
+ }
+
+ public List getOneOf() {
+ return oneOf;
+ }
+
+ public List getAnyOf() {
+ return anyOf;
+ }
+
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("CodegenComposedSchemas{");
+ sb.append("oneOf=").append(oneOf);
+ sb.append(", anyOf=").append(anyOf);
+ sb.append(", allOf=").append(allOf);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ CodegenComposedSchemas that = (CodegenComposedSchemas) o;
+ return Objects.equals(oneOf, that.oneOf) &&
+ Objects.equals(anyOf, that.anyOf) &&
+ Objects.equals(allOf, that.allOf);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(oneOf, anyOf, allOf);
+ }
+}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
index ab9f23fba67..e09c32c96b2 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
@@ -49,11 +49,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public Set oneOf = new TreeSet();
public Set allOf = new TreeSet();
- // anyOf, oneOf, allOf with full properties/tags (e.g. isString, etc)
- public List anyOfProps = new ArrayList<>();
- public List allOfProps = new ArrayList<>();
- public List oneOfProps = new ArrayList<>();
-
// The schema name as written in the OpenAPI document.
public String name;
// The language-specific name of the class that implements this schema.
@@ -110,6 +105,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public ExternalDocumentation externalDocumentation;
public Map vendorExtensions = new HashMap();
+ private CodegenComposedSchemas composedSchemas;
/**
* The type of the value for the additionalProperties keyword in the OAS document.
@@ -810,6 +806,16 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
this.isAnyType = isAnyType;
}
+ @Override
+ public void setComposedSchemas(CodegenComposedSchemas composedSchemas) {
+ this.composedSchemas = composedSchemas;
+ }
+
+ @Override
+ public CodegenComposedSchemas getComposedSchemas() {
+ return composedSchemas;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -849,6 +855,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
getUniqueItems() == that.getUniqueItems() &&
getExclusiveMinimum() == that.getExclusiveMinimum() &&
getExclusiveMaximum() == that.getExclusiveMaximum() &&
+ Objects.equals(composedSchemas, that.composedSchemas) &&
Objects.equals(parent, that.parent) &&
Objects.equals(parentSchema, that.parentSchema) &&
Objects.equals(interfaces, that.interfaces) &&
@@ -856,9 +863,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
Objects.equals(parentModel, that.parentModel) &&
Objects.equals(interfaceModels, that.interfaceModels) &&
Objects.equals(children, that.children) &&
- Objects.equals(anyOf, that.anyOfProps) &&
- Objects.equals(oneOf, that.oneOfProps) &&
- Objects.equals(allOf, that.allOfProps) &&
Objects.equals(anyOf, that.anyOf) &&
Objects.equals(oneOf, that.oneOf) &&
Objects.equals(allOf, that.allOf) &&
@@ -921,8 +925,8 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
getAdditionalPropertiesType(), getMaxProperties(), getMinProperties(), getUniqueItems(), getMaxItems(),
getMinItems(), getMaxLength(), getMinLength(), getExclusiveMinimum(), getExclusiveMaximum(), getMinimum(),
getMaximum(), getPattern(), getMultipleOf(), getItems(), getAdditionalProperties(), getIsModel(),
- getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping, anyOfProps, oneOfProps, allOfProps,
- isAnyType);
+ getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping,
+ isAnyType, getComposedSchemas());
}
@Override
@@ -938,9 +942,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
sb.append(", anyOf=").append(anyOf);
sb.append(", oneOf=").append(oneOf);
sb.append(", allOf=").append(allOf);
- sb.append(", anyOf=").append(anyOfProps);
- sb.append(", oneOf=").append(oneOfProps);
- sb.append(", allOf=").append(allOfProps);
sb.append(", name='").append(name).append('\'');
sb.append(", classname='").append(classname).append('\'');
sb.append(", title='").append(title).append('\'');
@@ -1017,6 +1018,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
sb.append(", getAdditionalPropertiesIsAnyType=").append(getAdditionalPropertiesIsAnyType());
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
sb.append(", getIsAnyType=").append(getIsAnyType());
+ sb.append(", composedSchemas=").append(composedSchemas);
sb.append('}');
return sb.toString();
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
index ebd01afdfd2..e0f962215df 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
@@ -107,6 +107,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
public boolean isNull;
private boolean hasRequired;
private boolean hasDiscriminatorWithNonEmptyMapping;
+ private CodegenComposedSchemas composedSchemas;
public CodegenParameter copy() {
CodegenParameter output = new CodegenParameter();
@@ -159,6 +160,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
output.setHasRequired(this.hasRequired);
output.setHasDiscriminatorWithNonEmptyMapping(this.hasDiscriminatorWithNonEmptyMapping);
+ if (this.composedSchemas != null) {
+ output.setComposedSchemas(this.getComposedSchemas());
+ }
if (this._enum != null) {
output._enum = new ArrayList(this._enum);
}
@@ -216,7 +220,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
@Override
public int hashCode() {
- return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping);
+ return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping, composedSchemas);
}
@Override
@@ -271,6 +275,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
getExclusiveMaximum() == that.getExclusiveMaximum() &&
getExclusiveMinimum() == that.getExclusiveMinimum() &&
getUniqueItems() == that.getUniqueItems() &&
+ Objects.equals(composedSchemas, that.getComposedSchemas()) &&
Objects.equals(baseName, that.baseName) &&
Objects.equals(paramName, that.paramName) &&
Objects.equals(dataType, that.dataType) &&
@@ -393,6 +398,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
sb.append(", getHasVars=").append(hasVars);
sb.append(", getHasRequired=").append(hasRequired);
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
+ sb.append(", composedSchemas=").append(composedSchemas);
sb.append('}');
return sb.toString();
}
@@ -706,5 +712,15 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
public void setIsAnyType(boolean isAnyType) {
this.isAnyType = isAnyType;
}
+
+ @Override
+ public void setComposedSchemas(CodegenComposedSchemas composedSchemas) {
+ this.composedSchemas = composedSchemas;
+ }
+
+ @Override
+ public CodegenComposedSchemas getComposedSchemas() {
+ return composedSchemas;
+ }
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
index ed1636fc6d5..e326a052fca 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
@@ -191,6 +191,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
private boolean hasVars;
private boolean hasRequired;
private boolean hasDiscriminatorWithNonEmptyMapping;
+ private CodegenComposedSchemas composedSchemas = null;
public String getBaseName() {
return baseName;
@@ -614,6 +615,16 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
this.xmlNamespace = xmlNamespace;
}
+ @Override
+ public void setComposedSchemas(CodegenComposedSchemas composedSchemas) {
+ this.composedSchemas = composedSchemas;
+ }
+
+ @Override
+ public CodegenComposedSchemas getComposedSchemas() {
+ return composedSchemas;
+ }
+
@Override
public CodegenProperty clone() {
try {
@@ -642,6 +653,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
if (this.vendorExtensions != null) {
cp.vendorExtensions = new HashMap(this.vendorExtensions);
}
+ if (this.composedSchemas != null) {
+ cp.composedSchemas = this.composedSchemas;
+ }
return cp;
} catch (CloneNotSupportedException e) {
@@ -882,6 +896,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
sb.append(", getHasVars=").append(getHasVars());
sb.append(", getHasRequired=").append(getHasRequired());
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
+ sb.append(", composedSchemas=").append(composedSchemas);
sb.append('}');
return sb.toString();
}
@@ -937,6 +952,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getHasVars() == that.getHasVars() &&
getHasRequired() ==that.getHasRequired() &&
+ Objects.equals(composedSchemas, that.composedSchemas) &&
Objects.equals(openApiType, that.openApiType) &&
Objects.equals(baseName, that.baseName) &&
Objects.equals(complexType, that.complexType) &&
@@ -999,6 +1015,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
vendorExtensions, hasValidation, isInherited, discriminatorValue, nameInCamelCase,
nameInSnakeCase, enumName, maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName,
xmlNamespace, isXmlWrapped, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired,
- hasDiscriminatorWithNonEmptyMapping);
+ hasDiscriminatorWithNonEmptyMapping, composedSchemas);
}
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java
index 1a99e774e59..545628931c7 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java
@@ -85,6 +85,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
private boolean hasVars;
private boolean hasRequired;
private boolean hasDiscriminatorWithNonEmptyMapping;
+ private CodegenComposedSchemas composedSchemas;
@Override
public int hashCode() {
@@ -96,7 +97,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(),
getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(),
is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired,
- hasDiscriminatorWithNonEmptyMapping);
+ hasDiscriminatorWithNonEmptyMapping, composedSchemas);
}
@Override
@@ -144,6 +145,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getHasVars() == that.getHasVars() &&
getHasRequired() == that.getHasRequired() &&
+ Objects.equals(composedSchemas, that.getComposedSchemas()) &&
Objects.equals(vars, that.vars) &&
Objects.equals(requiredVars, that.requiredVars) &&
Objects.equals(headers, that.headers) &&
@@ -482,6 +484,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
sb.append(", getHasVars=").append(hasVars);
sb.append(", getHasRequired=").append(hasRequired);
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
+ sb.append(", composedSchemas=").append(composedSchemas);
sb.append('}');
return sb.toString();
}
@@ -570,4 +573,14 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
public void setIsAnyType(boolean isAnyType) {
this.isAnyType = isAnyType;
}
+
+ @Override
+ public void setComposedSchemas(CodegenComposedSchemas composedSchemas) {
+ this.composedSchemas = composedSchemas;
+ }
+
+ @Override
+ public CodegenComposedSchemas getComposedSchemas() {
+ return composedSchemas;
+ }
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
index d5920a2abc7..2c530aeaffe 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
@@ -2440,9 +2440,6 @@ public class DefaultCodegen implements CodegenConfig {
// interfaces (schemas defined in allOf, anyOf, oneOf)
List interfaces = ModelUtils.getInterfaces(composed);
- List anyOfProps = new ArrayList<>();
- List allOfProps = new ArrayList<>();
- List oneOfProps = new ArrayList<>();
if (!interfaces.isEmpty()) {
// m.interfaces is for backward compatibility
if (m.interfaces == null)
@@ -2467,7 +2464,6 @@ public class DefaultCodegen implements CodegenConfig {
LOGGER.warn("{} (anyOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType);
} else {
m.anyOf.add(languageType);
- anyOfProps.add(interfaceProperty);
}
} else if (composed.getOneOf() != null) {
@@ -2475,7 +2471,6 @@ public class DefaultCodegen implements CodegenConfig {
LOGGER.warn("{} (oneOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType);
} else {
m.oneOf.add(languageType);
- oneOfProps.add(interfaceProperty);
}
} else if (composed.getAllOf() != null) {
// no need to add primitive type to allOf, which should comprise of schemas (models) only
@@ -2511,23 +2506,16 @@ public class DefaultCodegen implements CodegenConfig {
if (composed.getAnyOf() != null) {
m.anyOf.add(modelName);
- anyOfProps.add(interfaceProperty);
} else if (composed.getOneOf() != null) {
m.oneOf.add(modelName);
- oneOfProps.add(interfaceProperty);
} else if (composed.getAllOf() != null) {
m.allOf.add(modelName);
- allOfProps.add(interfaceProperty);
} else {
LOGGER.error("Composed schema has incorrect anyOf, allOf, oneOf defined: {}", composed);
}
}
}
- m.oneOfProps = oneOfProps;
- m.allOfProps = allOfProps;
- m.anyOfProps = anyOfProps;
-
if (parent != null && composed.getAllOf() != null) { // set parent for allOf only
m.parentSchema = parentName;
m.parent = toModelName(parentName);
@@ -2696,6 +2684,7 @@ public class DefaultCodegen implements CodegenConfig {
}
m.setTypeProperties(schema);
+ m.setComposedSchemas(getComposedSchemas(schema));
if (ModelUtils.isArraySchema(schema)) {
CodegenProperty arrayProperty = fromProperty(name, schema);
m.setItems(arrayProperty.items);
@@ -3514,6 +3503,7 @@ public class DefaultCodegen implements CodegenConfig {
}
property.setTypeProperties(p);
+ property.setComposedSchemas(getComposedSchemas(p));
if (ModelUtils.isIntegerSchema(p)) { // integer type
property.isNumeric = Boolean.TRUE;
if (ModelUtils.isLongSchema(p)) { // int64/long format
@@ -4265,6 +4255,7 @@ public class DefaultCodegen implements CodegenConfig {
}
r.setTypeProperties(responseSchema);
+ r.setComposedSchemas(getComposedSchemas(responseSchema));
if (ModelUtils.isArraySchema(responseSchema)) {
r.simpleType = false;
r.containerType = cp.containerType;
@@ -4547,6 +4538,7 @@ public class DefaultCodegen implements CodegenConfig {
}
ModelUtils.syncValidationProperties(parameterSchema, codegenParameter);
codegenParameter.setTypeProperties(parameterSchema);
+ codegenParameter.setComposedSchemas(getComposedSchemas(parameterSchema));
if (Boolean.TRUE.equals(parameterSchema.getNullable())) { // use nullable defined in the spec
codegenParameter.isNullable = true;
@@ -6156,6 +6148,7 @@ public class DefaultCodegen implements CodegenConfig {
Schema ps = unaliasSchema(propertySchema, importMapping);
ModelUtils.syncValidationProperties(ps, codegenParameter);
codegenParameter.setTypeProperties(ps);
+ codegenParameter.setComposedSchemas(getComposedSchemas(ps));
if (ps.getPattern() != null) {
codegenParameter.pattern = toRegularExpression(ps.getPattern());
}
@@ -6590,6 +6583,7 @@ public class DefaultCodegen implements CodegenConfig {
ModelUtils.syncValidationProperties(unaliasedSchema, codegenParameter);
codegenParameter.setTypeProperties(unaliasedSchema);
+ codegenParameter.setComposedSchemas(getComposedSchemas(unaliasedSchema));
// TODO in the future switch al the below schema usages to unaliasedSchema
// because it keeps models as refs and will not get their referenced schemas
if (ModelUtils.isArraySchema(schema)) {
@@ -7154,4 +7148,30 @@ public class DefaultCodegen implements CodegenConfig {
protected String getCollectionFormat(CodegenParameter codegenParameter) {
return null;
}
+
+ private CodegenComposedSchemas getComposedSchemas(Schema schema) {
+ if (!(schema instanceof ComposedSchema)) {
+ return null;
+ }
+ ComposedSchema cs = (ComposedSchema) schema;
+ return new CodegenComposedSchemas(
+ getComposedProperties(cs.getAllOf(), "allOf"),
+ getComposedProperties(cs.getOneOf(), "oneOf"),
+ getComposedProperties(cs.getAnyOf(), "anyOf")
+ );
+ }
+
+ private List getComposedProperties(List xOfCollection, String collectionName) {
+ if (xOfCollection == null) {
+ return null;
+ }
+ List xOf = new ArrayList<>();
+ int i = 0;
+ for (Schema xOfSchema: xOfCollection) {
+ CodegenProperty cp = fromProperty(collectionName + "_" + String.valueOf(i), xOfSchema);
+ xOf.add(cp);
+ i += 1;
+ }
+ return xOf;
+ }
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java
index b3833e47f6f..fe80c549ac6 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java
@@ -145,6 +145,11 @@ public interface IJsonSchemaValidationProperties {
void setIsAnyType(boolean isAnyType);
+ CodegenComposedSchemas getComposedSchemas();
+
+ void setComposedSchemas(CodegenComposedSchemas composedSchemas);
+
+
/**
* Syncs all the schema's type properties into the IJsonSchemaValidationProperties instance
* for now this only supports types without format information
diff --git a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java
index 859109086a5..70d25fdaee1 100644
--- a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java
+++ b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java
@@ -539,10 +539,10 @@ public interface PathHandlerInterface {
* Response headers: [CodegenProperty{openApiType='integer', baseName='X-Rate-Limit', complexType='null', getter='getxRateLimit', setter='setxRateLimit', description='calls per hour allowed by the user', dataType='Integer', datatypeWithEnum='Integer', dataFormat='int32', name='xRateLimit', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Rate-Limit;', baseType='Integer', containerType='null', title='null', unescapedDescription='calls per hour allowed by the user', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{
"type" : "integer",
"format" : "int32"
-}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=true, isModel=false, isContainer=false, isString=false, isNumeric=true, isInteger=true, isShort=true, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XRateLimit', nameInSnakeCase='X_RATE_LIMIT', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false}, CodegenProperty{openApiType='string', baseName='X-Expires-After', complexType='Date', getter='getxExpiresAfter', setter='setxExpiresAfter', description='date in UTC when token expires', dataType='Date', datatypeWithEnum='Date', dataFormat='date-time', name='xExpiresAfter', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Expires-After;', baseType='Date', containerType='null', title='null', unescapedDescription='date in UTC when token expires', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{
+}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=true, isModel=false, isContainer=false, isString=false, isNumeric=true, isInteger=true, isShort=true, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XRateLimit', nameInSnakeCase='X_RATE_LIMIT', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false, composedSchemas=null}, CodegenProperty{openApiType='string', baseName='X-Expires-After', complexType='Date', getter='getxExpiresAfter', setter='setxExpiresAfter', description='date in UTC when token expires', dataType='Date', datatypeWithEnum='Date', dataFormat='date-time', name='xExpiresAfter', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Expires-After;', baseType='Date', containerType='null', title='null', unescapedDescription='date in UTC when token expires', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{
"type" : "string",
"format" : "date-time"
-}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=false, isModel=false, isContainer=false, isString=false, isNumeric=false, isInteger=false, isShort=false, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=true, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XExpiresAfter', nameInSnakeCase='X_EXPIRES_AFTER', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false}]
+}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=false, isModel=false, isContainer=false, isString=false, isNumeric=false, isInteger=false, isShort=false, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=true, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XExpiresAfter', nameInSnakeCase='X_EXPIRES_AFTER', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false, composedSchemas=null}]
*
* Produces: [{mediaType=application/xml}, {mediaType=application/json}]
* Returns: {@link String}
From ae39d782e01d38c199c78ceb6d96124a03fa4b99 Mon Sep 17 00:00:00 2001
From: cyangle
Date: Wed, 27 Oct 2021 01:23:55 -0500
Subject: [PATCH 07/25] Update crystal client gitignore.mustache with shards
related files (#10698)
---
.../main/resources/crystal/gitignore.mustache | 45 +++++--------------
samples/client/petstore/crystal/.gitignore | 45 +++++--------------
2 files changed, 20 insertions(+), 70 deletions(-)
diff --git a/modules/openapi-generator/src/main/resources/crystal/gitignore.mustache b/modules/openapi-generator/src/main/resources/crystal/gitignore.mustache
index 05a17cb8f0a..1a7e69fd1cd 100644
--- a/modules/openapi-generator/src/main/resources/crystal/gitignore.mustache
+++ b/modules/openapi-generator/src/main/resources/crystal/gitignore.mustache
@@ -1,39 +1,14 @@
# Generated by: https://openapi-generator.tech
#
-*.gem
-*.rbc
-/.config
-/coverage/
-/InstalledFiles
-/pkg/
-/spec/reports/
-/spec/examples.txt
-/test/tmp/
-/test/version_tmp/
+/docs/
+/lib/
+/bin/
+/.shards/
+*.dwarf
+
+# Libraries don't need dependency lock
+# Dependencies will be locked in applications that use them
+/shard.lock
+
/tmp/
-
-## Specific to RubyMotion:
-.dat*
-.repl_history
-build/
-
-## Documentation cache and generated files:
-/.yardoc/
-/_yardoc/
-/doc/
-/rdoc/
-
-## Environment normalization:
-/.bundle/
-/vendor/bundle
-/lib/bundler/man/
-
-# for a library or gem, you might want to ignore these files since the code is
-# intended to run in multiple environments; otherwise, check them in:
-# Gemfile.lock
-# .ruby-version
-# .ruby-gemset
-
-# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
-.rvmrc
diff --git a/samples/client/petstore/crystal/.gitignore b/samples/client/petstore/crystal/.gitignore
index 05a17cb8f0a..1a7e69fd1cd 100644
--- a/samples/client/petstore/crystal/.gitignore
+++ b/samples/client/petstore/crystal/.gitignore
@@ -1,39 +1,14 @@
# Generated by: https://openapi-generator.tech
#
-*.gem
-*.rbc
-/.config
-/coverage/
-/InstalledFiles
-/pkg/
-/spec/reports/
-/spec/examples.txt
-/test/tmp/
-/test/version_tmp/
+/docs/
+/lib/
+/bin/
+/.shards/
+*.dwarf
+
+# Libraries don't need dependency lock
+# Dependencies will be locked in applications that use them
+/shard.lock
+
/tmp/
-
-## Specific to RubyMotion:
-.dat*
-.repl_history
-build/
-
-## Documentation cache and generated files:
-/.yardoc/
-/_yardoc/
-/doc/
-/rdoc/
-
-## Environment normalization:
-/.bundle/
-/vendor/bundle
-/lib/bundler/man/
-
-# for a library or gem, you might want to ignore these files since the code is
-# intended to run in multiple environments; otherwise, check them in:
-# Gemfile.lock
-# .ruby-version
-# .ruby-gemset
-
-# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
-.rvmrc
From 6bbafdfa309da6a805c9e606a0eaa223e11a22ab Mon Sep 17 00:00:00 2001
From: Maximilian Zellhofer
Date: Wed, 27 Oct 2021 08:28:17 +0200
Subject: [PATCH 08/25] Allow specification of configkey for microprofile
clients (#10693)
---
bin/configs/java-microprofile-rest-client.yaml | 1 +
.../codegen/languages/JavaClientCodegen.java | 10 ++++++++++
.../resources/Java/libraries/microprofile/api.mustache | 2 +-
.../main/java/org/openapitools/client/api/PetApi.java | 2 +-
.../java/org/openapitools/client/api/StoreApi.java | 2 +-
.../main/java/org/openapitools/client/api/UserApi.java | 2 +-
6 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/bin/configs/java-microprofile-rest-client.yaml b/bin/configs/java-microprofile-rest-client.yaml
index 2d9796db540..384a6aa7f30 100644
--- a/bin/configs/java-microprofile-rest-client.yaml
+++ b/bin/configs/java-microprofile-rest-client.yaml
@@ -5,3 +5,4 @@ inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: microprofile-rest-client
+ configKey: petstore
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java
index 328a4b089b2..1d8b4f18ba2 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java
@@ -56,6 +56,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
public static final String USE_PLAY_WS = "usePlayWS";
public static final String PLAY_VERSION = "playVersion";
public static final String ASYNC_NATIVE = "asyncNative";
+ public static final String CONFIGKEY = "configKey";
public static final String PARCELABLE_MODEL = "parcelableModel";
public static final String USE_RUNTIME_EXCEPTION = "useRuntimeException";
public static final String USE_REFLECTION_EQUALS_HASHCODE = "useReflectionEqualsHashCode";
@@ -102,6 +103,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
protected boolean usePlayWS = false;
protected String playVersion = PLAY_26;
protected String microprofileFramework = MICROPROFILE_DEFAULT;
+ protected String configKey = null;
protected boolean asyncNative = false;
protected boolean parcelableModel = false;
@@ -281,6 +283,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
}
additionalProperties.put(MICROPROFILE_FRAMEWORK, microprofileFramework);
+ if (additionalProperties.containsKey(CONFIGKEY)) {
+ this.setConfigKey(additionalProperties.get(CONFIGKEY).toString());
+ }
+
if (additionalProperties.containsKey(ASYNC_NATIVE)) {
this.setAsyncNative(convertPropertyToBooleanAndWriteBack(ASYNC_NATIVE));
}
@@ -964,6 +970,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
this.microprofileFramework = microprofileFramework;
}
+ public void setConfigKey(String configKey) {
+ this.configKey = configKey;
+ }
+
public void setParcelableModel(boolean parcelableModel) {
this.parcelableModel = parcelableModel;
}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache
index f6a69ff6a7c..119494e54d3 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache
@@ -30,7 +30,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
*/
{{/appName}}
-@RegisterRestClient
+@RegisterRestClient{{#configKey}}(configKey="{{configKey}}"){{/configKey}}
@RegisterProvider(ApiExceptionMapper.class)
@Path("{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}{{commonPath}}")
public interface {{classname}} {
diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java
index 01f075d1cc0..3d2ecd955a5 100644
--- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java
+++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java
@@ -36,7 +36,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
*
*/
-@RegisterRestClient
+@RegisterRestClient(configKey="petstore")
@RegisterProvider(ApiExceptionMapper.class)
@Path("/pet")
public interface PetApi {
diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/StoreApi.java
index 4e5844e79ad..fc5b9b52f29 100644
--- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/StoreApi.java
+++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/StoreApi.java
@@ -34,7 +34,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
*
*/
-@RegisterRestClient
+@RegisterRestClient(configKey="petstore")
@RegisterProvider(ApiExceptionMapper.class)
@Path("/store")
public interface StoreApi {
diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java
index 41c31a4d49d..b9fd9ed12a0 100644
--- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java
+++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java
@@ -34,7 +34,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
*
*/
-@RegisterRestClient
+@RegisterRestClient(configKey="petstore")
@RegisterProvider(ApiExceptionMapper.class)
@Path("/user")
public interface UserApi {
From 5e857e749d33a0de931372e8f6759dd13a4858ff Mon Sep 17 00:00:00 2001
From: William Cheng
Date: Wed, 27 Oct 2021 15:07:41 +0800
Subject: [PATCH 09/25] add an option for configKey (#10707)
---
docs/generators/java.md | 1 +
.../openapitools/codegen/languages/JavaClientCodegen.java | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/docs/generators/java.md b/docs/generators/java.md
index 0cb76c15409..8b360b4b427 100644
--- a/docs/generators/java.md
+++ b/docs/generators/java.md
@@ -19,6 +19,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false|
+|configKey|Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.| |null|
|dateLibrary|Option. Date library to use|- **joda**
- Joda (for legacy app only)
- **legacy**
- Legacy java.util.Date (if you really have a good reason not to use threetenbp
- **java8-localdatetime**
- Java 8 using LocalDateTime (for legacy app only)
- **java8**
- Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true
- **threetenbp**
- Backport of JSR310 (preferred for jdk < 1.8)
|threetenbp|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java
index 1d8b4f18ba2..1e2740f1858 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java
@@ -56,7 +56,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
public static final String USE_PLAY_WS = "usePlayWS";
public static final String PLAY_VERSION = "playVersion";
public static final String ASYNC_NATIVE = "asyncNative";
- public static final String CONFIGKEY = "configKey";
+ public static final String CONFIG_KEY = "configKey";
public static final String PARCELABLE_MODEL = "parcelableModel";
public static final String USE_RUNTIME_EXCEPTION = "useRuntimeException";
public static final String USE_REFLECTION_EQUALS_HASHCODE = "useReflectionEqualsHashCode";
@@ -162,6 +162,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
cliOptions.add(CliOption.newBoolean(DYNAMIC_OPERATIONS, "Generate operations dynamically at runtime from an OAS", this.dynamicOperations));
cliOptions.add(CliOption.newBoolean(SUPPORT_STREAMING, "Support streaming endpoint (beta)", this.supportStreaming));
cliOptions.add(CliOption.newString(GRADLE_PROPERTIES, "Append additional Gradle proeprties to the gradle.properties file"));
+ cliOptions.add(CliOption.newString(CONFIG_KEY, "Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option."));
supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libraries instead.");
supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x");
@@ -283,8 +284,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen
}
additionalProperties.put(MICROPROFILE_FRAMEWORK, microprofileFramework);
- if (additionalProperties.containsKey(CONFIGKEY)) {
- this.setConfigKey(additionalProperties.get(CONFIGKEY).toString());
+ if (additionalProperties.containsKey(CONFIG_KEY)) {
+ this.setConfigKey(additionalProperties.get(CONFIG_KEY).toString());
}
if (additionalProperties.containsKey(ASYNC_NATIVE)) {
From 27c82e8ed2b894eccc0d20f979354234e7df9f6f Mon Sep 17 00:00:00 2001
From: bflamand <33287817+bflamand@users.noreply.github.com>
Date: Wed, 27 Oct 2021 10:35:02 -0400
Subject: [PATCH 10/25] Typescript saga immutablejs enhancements and small
fixes (#10444)
* first commit: add cli option for saga and records. Added dummy sagas.mustache test file.
* More progress with default values. First prototype for isEntity and isUniqueId.
* record generation complete
* record generation complete
* progress with saga generation
* progress with saga generation
* first fully working saga generation
* merge with latest master
* removed unneeded "items" properties.
* moved global CodegenModel modifications into subclass ExtendedCodegenModel used exclusively by TypescriptFetchClient. Adding missing samples files.
* moved global CodegenOperation modifications into subclass ExtendedCodegenOperation used exclusively by TypescriptFetchClient.
* moved global CodegenProperty modifications into subclass ExtendedCodegenProperty used exclusively by TypescriptFetchClient.
* moved global CodegenParameter modifications into subclass ExtendedCodegenParameter used exclusively by TypescriptFetchClient.
* added the missing "allSagas" export.
* renamed & reworked "meta data response" flags to a more useful general concept of "operation return passthrough"
* added vendor flag keepAsJSObject as escape hatch to support circular dependencies in models and other special cases. Also fixed issues with default values for some records properties.
* added autodetection for passthrough to simplify standardised specs.
* fix small issue with passthrough void
* fix small issues with passthrough void and missing passthrough imports in some cases. Fix issues with enum default values.
* fix small issues with passthrough void and missing passthrough imports in some cases. Fix issues with enum default values.
* Added "reservedRecordField" feature to support remapping fields names that cannot be used in Records. Added missing export to record: toApi().
* added uniqueId inference. Fix small generation when uniqueId property is an array.
* removed feature "reservedRecordField" and replaced it with existing built-in "reserved words" feature. Fix minor issues with typings in generated files.
* Changed api recType names to make them less likely to cause name conflicts. Added generated ApiEntities (record, reducer & selector) files.
* Moved location of ApiEntities related files and fix issues with exports.
* - merge latest master
- renamed fake test apis to better fit the "pet theme"
- added mode for "SourceOnlyLibrary" (same as used in codegen typescript jquery)
* - missing ganarate sampless
* - Modified way to export apiEntitiesSelectpr to reduce typescript analysis time for consuming project. Removed tab characters in mustache files. Reformat code for TypeScriptFetchClientCodegen to try to remove false positive for tabs vs spaces.
* - added markErrorsAsHandled property to api sagas. Increased typescript version to address some typing errors on library build.
* - fix bug in saga interfaces. Upgraded to typescript "strict" mode to ensure proper typechecking info is generated.
* - added optional id for apiEntity selectors. Added toInlined() support to convert an entity to an inlined model recursively.
* - minor tweak for apiEntitySelector to accept null id
* - minor tweak for apiEntitySelector
* - runned ensure up to date.
* Revert "- runned ensure up to date."
This reverts commit ea9b4aed
* - runned ensure up to date.
* - runned ensure up to date.
* - added more enhancements: New "toInlined" functionality. Support for more complex double array types. apiBaseConfiguration is not sent completely for Api.init().
* - merge master
* - fix generated api bug in some cases for typescript fetch when no request params are present.
* - commented broken tests
* - fix generate samples analysis.
* update surefire to newer version
* - un-commenting test files with issues.
* factored similar utility functions in ExtendedCodegenProperty and ExtendedCodegenParameter.
Co-authored-by: Bruno Flamand
Co-authored-by: William Cheng
---
.../TypeScriptFetchClientCodegen.java | 95 ++++++++++++++---
.../resources/typescript-fetch/apis.mustache | 2 +-
.../typescript-fetch/recordGeneric.mustache | 28 ++++-
.../typescript-fetch/sagaApiManager.mustache | 10 +-
.../resources/typescript-fetch/sagas.mustache | 9 +-
.../markdown/MarkdownSampleGeneratorTest.java | 2 +-
...s-models-for-testing-saga-and-records.yaml | 62 +++++++++++
.../multiple-parameters/apis/UserApi.ts | 2 +-
.../.openapi-generator/FILES | 2 +
.../sagas-and-records/src/apis/PetApi.ts | 79 ++++++++++++++
.../sagas-and-records/src/apis/PetApiSagas.ts | 100 +++++++++++++++++-
.../src/apis/SagaApiManager.ts | 10 +-
.../sagas-and-records/src/apis/UserApi.ts | 2 +-
.../src/models/CategoryRecord.ts | 2 +
.../src/models/GetPetRegionsResponse.ts | 72 +++++++++++++
.../src/models/GetPetRegionsResponseRecord.ts | 74 +++++++++++++
.../src/models/OrderRecord.ts | 2 +
.../sagas-and-records/src/models/Pet.ts | 8 ++
.../sagas-and-records/src/models/PetRecord.ts | 14 ++-
.../src/models/PetRegionsResponse.ts | 71 +++++++++++++
.../src/models/PetRegionsResponseRecord.ts | 74 +++++++++++++
.../sagas-and-records/src/models/TagRecord.ts | 2 +
.../src/models/UserRecord.ts | 2 +
.../sagas-and-records/src/models/index.ts | 2 +
24 files changed, 684 insertions(+), 42 deletions(-)
create mode 100644 samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetRegionsResponse.ts
create mode 100644 samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetRegionsResponseRecord.ts
create mode 100644 samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts
create mode 100644 samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponseRecord.ts
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java
index ed922219016..71d53818647 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java
@@ -708,15 +708,22 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
var.dataTypeAlternate = var.dataType;
if (var.isArray) {
+ var.isUniqueId = var.isUniqueId || var.itemsAreUniqueId();
var.dataTypeAlternate = var.dataType.replace("Array<", "List<");
+ String newItemsDataType = var.getItemsDataType();
if (var.items.isModel) {
- String itemsDataType = var.items.dataType + "Record";
- var.dataTypeAlternate = var.dataTypeAlternate.replace(var.items.dataType, itemsDataType);
+ newItemsDataType = var.items.dataType + "Record";
+ var.dataTypeAlternate = var.dataTypeAlternate.replace(var.items.dataType, newItemsDataType);
} else if (var.items.isEnum) {
- var.dataTypeAlternate = var.dataTypeAlternate.replace(var.items.dataType, var.items.datatypeWithEnum);
+ newItemsDataType = var.items.datatypeWithEnum;
+ var.dataTypeAlternate = var.dataTypeAlternate.replace(var.items.dataType, newItemsDataType);
+ } else if (var.isUniqueId) {
+ newItemsDataType = "string";
+ var.dataTypeAlternate = var.dataTypeAlternate.replace("number", newItemsDataType);
}
- if (var.isUniqueId) {
- var.dataTypeAlternate = var.dataTypeAlternate.replace("number", "string");
+
+ if (var.itemsAreNullable()) {
+ var.dataTypeAlternate = var.dataTypeAlternate.replace(newItemsDataType, newItemsDataType + " | null");
}
} else if (var.isEnum) {
var.dataTypeAlternate = var.datatypeWithEnum;
@@ -724,6 +731,9 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
var.dataTypeAlternate = var.dataType + "Record";
} else if (var.isUniqueId) {
var.dataTypeAlternate = "string";
+ if (var.isNullable) {
+ var.dataTypeAlternate = var.dataTypeAlternate + " | null";
+ }
}
if (var.defaultValue == null || var.defaultValue.equals("undefined")) {
this.autoSetDefaultValueForProperty(var);
@@ -732,6 +742,10 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
return parentIsEntity;
}
+ private boolean itemsAreNullable(ExtendedCodegenProperty var) {
+ return var.items.isNullable || (var.items.items != null && var.items.items.isNullable);
+ }
+
private void escapeOperationIds(Map operations) {
Map _operations = (Map) operations.get("operations");
List operationList = (List) _operations.get("operation");
@@ -816,19 +830,25 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
param.isUniqueId = this.isUniqueIdAccordingToNameSuffix(param.paramName);
}
+
param.dataTypeAlternate = param.dataType;
if (param.isArray) {
+ param.isUniqueId = param.isUniqueId || param.itemsAreUniqueId();
+ param.dataTypeAlternate = param.dataType.replace("Array<", "List<");
+ String newItemsDataType = param.getItemsDataType();
if (param.items.isModel) {
- String itemsDataType = param.items.dataType + "Record";
- param.dataTypeAlternate = param.dataType.replace("Array<", "List<");
- param.dataTypeAlternate = param.dataTypeAlternate.replace(param.items.dataType, itemsDataType);
+ newItemsDataType = param.items.dataType + "Record";
+ param.dataTypeAlternate = param.dataTypeAlternate.replace(param.items.dataType, newItemsDataType);
} else if (param.items.isEnum) {
+ newItemsDataType = param.datatypeWithEnum.substring(param.datatypeWithEnum.lastIndexOf("<") + 1, param.datatypeWithEnum.indexOf(">"));
param.dataTypeAlternate = param.datatypeWithEnum.replace("Array<", "List<");
- } else {
- param.dataTypeAlternate = param.dataType.replace("Array<", "List<");
+ } else if (param.isUniqueId) {
+ newItemsDataType = "string";
+ param.dataTypeAlternate = param.dataTypeAlternate.replace("number", newItemsDataType);
}
- if (param.isUniqueId) {
- param.dataTypeAlternate = param.dataTypeAlternate.replace("number", "string");
+
+ if (param.itemsAreNullable()) {
+ param.dataTypeAlternate = param.dataTypeAlternate.replace(newItemsDataType, newItemsDataType + " | null");
}
} else if (param.isEnum) {
param.dataTypeAlternate = param.datatypeWithEnum;
@@ -836,6 +856,9 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
param.dataTypeAlternate = param.dataType + "Record";
} else if (param.isUniqueId) {
param.dataTypeAlternate = "string";
+ if (param.isNullable) {
+ param.dataTypeAlternate = param.dataTypeAlternate + " | null";
+ }
}
}
}
@@ -912,10 +935,46 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
this.prefixParameterInterfaces = prefixParameterInterfaces;
}
+ private static boolean itemsAreUniqueId(CodegenProperty items) {
+ if (items.items != null) {
+ return itemsAreUniqueId(items.items);
+ };
+ if (items.vendorExtensions.get(X_IS_UNIQUE_ID) instanceof Boolean) {
+ return Boolean.TRUE.equals(items.vendorExtensions.get(X_IS_UNIQUE_ID));
+ }
+ return false;
+ }
+
+ private static boolean itemsAreNullable(CodegenProperty items) {
+ if (items.items != null) {
+ return itemsAreNullable(items.items);
+ };
+ return items.isNullable;
+ }
+
+ private static String getItemsDataType(CodegenProperty items) {
+ if (items.items != null) {
+ return getItemsDataType(items.items);
+ };
+ return items.dataType;
+ }
+
class ExtendedCodegenParameter extends CodegenParameter {
public String dataTypeAlternate;
public boolean isUniqueId; // this parameter represents a unique id (x-isUniqueId: true)
+ public boolean itemsAreUniqueId() {
+ return TypeScriptFetchClientCodegen.itemsAreUniqueId(this.items);
+ }
+
+ public boolean itemsAreNullable() {
+ return TypeScriptFetchClientCodegen.itemsAreNullable(this.items);
+ }
+
+ public String getItemsDataType() {
+ return TypeScriptFetchClientCodegen.getItemsDataType(this.items);
+ }
+
public ExtendedCodegenParameter(CodegenParameter cp) {
super();
@@ -1035,6 +1094,18 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
public boolean keepAsJSObject;
public boolean isReservedRecordField;
+ public boolean itemsAreUniqueId() {
+ return TypeScriptFetchClientCodegen.itemsAreUniqueId(this.items);
+ }
+
+ public boolean itemsAreNullable() {
+ return TypeScriptFetchClientCodegen.itemsAreNullable(this.items);
+ }
+
+ public String getItemsDataType() {
+ return TypeScriptFetchClientCodegen.getItemsDataType(this.items);
+ }
+
public ExtendedCodegenProperty(CodegenProperty cp) {
super();
diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache
index fb3d06db22c..74c0c77d712 100644
--- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache
@@ -337,7 +337,7 @@ export class {{classname}} extends runtime.BaseAPI {
return await response.value();
{{/returnType}}
{{^returnType}}
- await this.{{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }{{/allParams.0}}, initOverrides);
+ await this.{{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }, {{/allParams.0}}initOverrides);
{{/returnType}}
}
{{/useSingleRequestParameter}}
diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/recordGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/recordGeneric.mustache
index b418276e452..ebdb5fd2498 100644
--- a/modules/openapi-generator/src/main/resources/typescript-fetch/recordGeneric.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-fetch/recordGeneric.mustache
@@ -96,7 +96,17 @@ class {{classname}}RecordUtils extends ApiRecordUtils<{{classname}}, {{classname
(apiObject as any).recType = {{#isEntity}}asEntity ? {{classname}}RecordEntityProps.recType : {{/isEntity}}{{classname}}RecordProps.recType;
{{#vars}}
{{#isUniqueId}}
- {{^required}}if (apiObject.{{name}}) { {{/required}}(apiObject as any).{{name}} = apiObject.{{name}}.{{#isArray}}map(item => item.{{/isArray}}toString(){{#isArray}}){{/isArray}};{{^required}} } {{/required}}
+ {{#isArray}}
+ {{#items.isArray}}
+ {{^required}}if (apiObject.{{name}}) { {{/required}}(apiObject as any).{{name}} = apiObject.{{name}}.map(item => item.map(item2 => item2?.toString()));{{^required}} } {{/required}}
+ {{/items.isArray}}
+ {{^items.isArray}}
+ {{^required}}if (apiObject.{{name}}) { {{/required}}(apiObject as any).{{name}} = apiObject.{{name}}.map(item => item?.toString());{{^required}} } {{/required}}
+ {{/items.isArray}}
+ {{/isArray}}
+ {{^isArray}}
+ {{^required}}if (apiObject.{{name}}) { {{/required}}(apiObject as any).{{name}} = apiObject.{{name}}.toString();{{^required}} } {{/required}}
+ {{/isArray}}
{{/isUniqueId}}
{{^keepAsJSObject}}
{{#isModel}}
@@ -134,6 +144,7 @@ class {{classname}}RecordUtils extends ApiRecordUtils<{{classname}}, {{classname
public *toInlined(entityId?: string | null) {
if (!entityId) {return undefined; }
+ // @ts-ignore
const entity = yield select(apiEntity{{classname}}Selector, {id: entityId});
if (!entity) {return undefined; }
@@ -160,12 +171,14 @@ class {{classname}}RecordUtils extends ApiRecordUtils<{{classname}}, {{classname
{{#vars}}
{{#isEntity}}
{{^keepAsJSObject}}
+ // @ts-ignore
{{name}}: {{^required}}entity.{{name}} ? {{/required}}yield call({{#lambda.camelcase}}{{{dataTypeAlternate}}}{{/lambda.camelcase}}Utils.toInlined, entity.{{name}}){{^required}} : null{{/required}},
{{/keepAsJSObject}}
{{/isEntity}}
{{#isArray}}
{{#items.isEntity}}
{{^keepAsJSObject}}
+ // @ts-ignore
{{name}}: {{^required}}entity.{{name}} ? {{/required}}yield call({{#lambda.camelcase}}{{items.dataType}}{{/lambda.camelcase}}RecordUtils.toInlinedArray, entity.{{name}}){{^required}} : null{{/required}},
{{/keepAsJSObject}}
{{/items.isEntity}}
@@ -183,6 +196,7 @@ class {{classname}}RecordUtils extends ApiRecordUtils<{{classname}}, {{classname
if (!entityIds) {return null; }
let entities = List<{{classname}}Record>();
for (let entityIndex = 0; entityIndex < entityIds.count(); entityIndex++) {
+ // @ts-ignore
const entity = yield call(this.toInlined, entityIds.get(entityIndex));
if (entity) {
entities.push(entity);
@@ -196,7 +210,17 @@ class {{classname}}RecordUtils extends ApiRecordUtils<{{classname}}, {{classname
const apiObject = super.toApi(record);
{{#vars}}
{{#isUniqueId}}
- {{^required}}if (record.{{name}}) { {{/required}}apiObject.{{name}} = {{#isArray}}record.{{name}}.map(item => parseFloat(item)).toArray(){{/isArray}}{{^isArray}}parseFloat(record.{{name}}){{/isArray}};{{^required}} } {{/required}}
+ {{#isArray}}
+ {{#items.isArray}}
+ {{^required}}if (record.{{name}}) { {{/required}}apiObject.{{name}} = {{#isArray}}record.{{name}}.map(item => item.toArray().map(item2 => (item2 ? parseFloat(item2) : null) as number)).toArray(){{/isArray}};{{^required}} } {{/required}}
+ {{/items.isArray}}
+ {{^items.isArray}}
+ {{^required}}if (record.{{name}}) { {{/required}}apiObject.{{name}} = {{#isArray}}record.{{name}}.map(item => (item ? parseFloat(item) : null) as number).toArray(){{/isArray}};{{^required}} } {{/required}}
+ {{/items.isArray}}
+ {{/isArray}}
+ {{^isArray}}
+ {{^required}}if (record.{{name}}) { {{/required}}apiObject.{{name}} = {{^isArray}}parseFloat(record.{{name}}){{/isArray}};{{^required}} } {{/required}}
+ {{/isArray}}
{{/isUniqueId}}
{{^keepAsJSObject}}
{{#isModel}}
diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/sagaApiManager.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/sagaApiManager.mustache
index af6fa7fdd71..9713d9e632d 100644
--- a/modules/openapi-generator/src/main/resources/typescript-fetch/sagaApiManager.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-fetch/sagaApiManager.mustache
@@ -18,15 +18,7 @@ export class Api {
{{/apis}}
{{/apiInfo}}
- public static init(apiBasePath: string) {
- const apiBaseConfig: ConfigurationParameters = {
- basePath: apiBasePath,
- credentials: "include",
- headers: {
- 'Cache-Control': 'no-cache, no-store' // this is needed to prevent stalling issues in Chrome. Also it is a good behavior for api calls.
- }
- };
-
+ public static init(apiBaseConfig: ConfigurationParameters) {
{{#apiInfo}}
{{#apis}}
Api.{{#lambda.camelcase}}{{classFilename}}{{/lambda.camelcase}} = new {{classFilename}}(new Configuration(apiBaseConfig));
diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/sagas.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/sagas.mustache
index 5129d92758c..2aca1ebc23b 100644
--- a/modules/openapi-generator/src/main/resources/typescript-fetch/sagas.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-fetch/sagas.mustache
@@ -105,12 +105,17 @@ export function *{{nickname}}SagaImp(_action_: Action{{/returnType}} = yield apiCall(Api.{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}, Api.{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}.{{nickname}},
+ const response{{#returnType}}: Required<{{{returnType}}}>{{/returnType}} = yield apiCall(Api.{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}, Api.{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}.{{nickname}},
{{#allParams.0}}
{{#allParams}}
{{#isUniqueId}}
{{#isArray}}
- {{^required}}{{paramName}} ? {{/required}}{{paramName}}.map(p => parseFloat(p)).toArray(){{^required}} : undefined{{/required}},
+{{#items.isArray}}
+ {{^required}}{{paramName}} ? {{/required}}{{paramName}}.map(p => p.toArray().map(p2 => (p2 ? parseFloat(p2) : null) as number)).toArray(){{^required}} : undefined{{/required}},
+{{/items.isArray}}
+{{^items.isArray}}
+ {{^required}}{{paramName}} ? {{/required}}{{paramName}}.map(p => (p ? parseFloat(p) : null) as number ).toArray(){{^required}} : undefined{{/required}},
+{{/items.isArray}}
{{/isArray}}
{{^isArray}}
{{^required}}{{paramName}} ? {{/required}}parseFloat({{paramName}}){{^required}} : undefined{{/required}},
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/markdown/MarkdownSampleGeneratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/markdown/MarkdownSampleGeneratorTest.java
index db8a5b29cd0..4e7d98d2874 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/markdown/MarkdownSampleGeneratorTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/markdown/MarkdownSampleGeneratorTest.java
@@ -50,4 +50,4 @@ public class MarkdownSampleGeneratorTest {
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-saga-and-records.yaml b/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-saga-and-records.yaml
index 6455e05eebb..29c48ddc0bd 100644
--- a/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-saga-and-records.yaml
+++ b/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-saga-and-records.yaml
@@ -295,6 +295,46 @@ paths:
- 'write:pets'
- 'read:pets'
deprecated: true
+ '/pet/{petId}/regions':
+ get:
+ tags:
+ - pet
+ summary: Gets regions for a single pet.
+ operationId: getPetRegions
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet
+ required: true
+ type: integer
+ format: int64
+ responses:
+ 200:
+ description: OK
+ schema:
+ $ref: "#/definitions/PetRegionsResponse"
+ put:
+ tags:
+ - pet
+ summary: Updates the pet regions.
+ operationId: updatePetRegions
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet
+ required: true
+ type: integer
+ format: int64
+ - in: body
+ name: new-regions
+ required: true
+ schema:
+ $ref: "#/definitions/PetRegions"
+ responses:
+ 200:
+ description: OK
+ schema:
+ $ref: "#/definitions/PetRegionsResponse"
'/pet/{petId}':
get:
tags:
@@ -902,6 +942,8 @@ definitions:
- pending
- sold
default: pending
+ regions:
+ $ref: "#/definitions/PetRegions"
xml:
name: Pet
ApiResponse:
@@ -1127,6 +1169,15 @@ definitions:
- Long
description: "Type of pet part"
example: Linear
+ PetRegionsResponse:
+ type: object
+ required:
+ - meta
+ properties:
+ meta:
+ $ref: "#/definitions/ResponseMeta"
+ data:
+ $ref: "#/definitions/PetRegions"
GetMatchingPartsResponse:
type: object
required:
@@ -1173,3 +1224,14 @@ definitions:
StringBooleanMap:
additionalProperties:
type: boolean
+ PetRegions:
+ type: array
+ description: "An array of all 15-minute time slots in 24 hours."
+ items:
+ type: array
+ items:
+ description: "array of values entity id or null."
+ x-nullable: true
+ x-isUniqueId: true
+ type: integer
+ format: int64
diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts
index a9bb0facaf2..02f8d3948e0 100644
--- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts
+++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts
@@ -278,7 +278,7 @@ export class UserApi extends runtime.BaseAPI {
* Logs out current logged in user session
*/
async logoutUser(initOverrides?: RequestInit): Promise {
- await this.logoutUserRaw(, initOverrides);
+ await this.logoutUserRaw(initOverrides);
}
/**
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/.openapi-generator/FILES b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/.openapi-generator/FILES
index 354b10210e0..e0b52bf6e97 100644
--- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/.openapi-generator/FILES
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/.openapi-generator/FILES
@@ -57,6 +57,8 @@ src/models/Pet.ts
src/models/PetPartType.ts
src/models/PetPartTypeRecord.ts
src/models/PetRecord.ts
+src/models/PetRegionsResponse.ts
+src/models/PetRegionsResponseRecord.ts
src/models/ResponseMeta.ts
src/models/ResponseMetaRecord.ts
src/models/Tag.ts
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts
index fa782af9b14..bdc58ac3a1d 100644
--- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts
@@ -30,6 +30,9 @@ import {
Pet,
PetFromJSON,
PetToJSON,
+ PetRegionsResponse,
+ PetRegionsResponseFromJSON,
+ PetRegionsResponseToJSON,
} from '../models';
export interface AddPetRequest {
@@ -61,10 +64,19 @@ export interface GetPetByIdRequest {
petId: number;
}
+export interface GetPetRegionsRequest {
+ petId: number;
+}
+
export interface UpdatePetRequest {
body: Pet;
}
+export interface UpdatePetRegionsRequest {
+ petId: number;
+ newRegions: Array>;
+}
+
export interface UpdatePetWithFormRequest {
petId: number;
name?: string;
@@ -357,6 +369,36 @@ export class PetApi extends runtime.BaseAPI {
return await response.value();
}
+ /**
+ * Gets regions for a single pet.
+ */
+ async getPetRegionsRaw(requestParameters: GetPetRegionsRequest, initOverrides?: RequestInit): Promise> {
+ if (requestParameters.petId === null || requestParameters.petId === undefined) {
+ throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetRegions.');
+ }
+
+ const queryParameters: any = {};
+
+ const headerParameters: runtime.HTTPHeaders = {};
+
+ const response = await this.request({
+ path: `/pet/{petId}/regions`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))),
+ method: 'GET',
+ headers: headerParameters,
+ query: queryParameters,
+ }, initOverrides);
+
+ return new runtime.JSONApiResponse(response, (jsonValue) => PetRegionsResponseFromJSON(jsonValue));
+ }
+
+ /**
+ * Gets regions for a single pet.
+ */
+ async getPetRegions(petId: number, initOverrides?: RequestInit): Promise {
+ const response = await this.getPetRegionsRaw({ petId: petId }, initOverrides);
+ return await response.value();
+ }
+
/**
* Update an existing pet
*/
@@ -394,6 +436,43 @@ export class PetApi extends runtime.BaseAPI {
await this.updatePetRaw({ body: body }, initOverrides);
}
+ /**
+ * Updates the pet regions.
+ */
+ async updatePetRegionsRaw(requestParameters: UpdatePetRegionsRequest, initOverrides?: RequestInit): Promise> {
+ if (requestParameters.petId === null || requestParameters.petId === undefined) {
+ throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetRegions.');
+ }
+
+ if (requestParameters.newRegions === null || requestParameters.newRegions === undefined) {
+ throw new runtime.RequiredError('newRegions','Required parameter requestParameters.newRegions was null or undefined when calling updatePetRegions.');
+ }
+
+ const queryParameters: any = {};
+
+ const headerParameters: runtime.HTTPHeaders = {};
+
+ headerParameters['Content-Type'] = 'application/json';
+
+ const response = await this.request({
+ path: `/pet/{petId}/regions`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))),
+ method: 'PUT',
+ headers: headerParameters,
+ query: queryParameters,
+ body: requestParameters.newRegions,
+ }, initOverrides);
+
+ return new runtime.JSONApiResponse(response, (jsonValue) => PetRegionsResponseFromJSON(jsonValue));
+ }
+
+ /**
+ * Updates the pet regions.
+ */
+ async updatePetRegions(petId: number, newRegions: Array>, initOverrides?: RequestInit): Promise {
+ const response = await this.updatePetRegionsRaw({ petId: petId, newRegions: newRegions }, initOverrides);
+ return await response.value();
+ }
+
/**
* Updates a pet in the store with form data
*/
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApiSagas.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApiSagas.ts
index 202ec780b63..b2c83e26802 100644
--- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApiSagas.ts
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApiSagas.ts
@@ -35,6 +35,9 @@ import {
Pet,
PetRecord,
petRecordUtils,
+ PetRegionsResponse,
+ PetRegionsResponseRecord,
+ petRegionsResponseRecordUtils,
UserRecord,
} from '../models';
@@ -52,7 +55,9 @@ export const petApiSagaMap = new Map Generator>([
["findPetsByTags", findPetsByTagsSaga],
["findPetsByUserIds", findPetsByUserIdsSaga],
["getPetById", getPetByIdSaga],
+ ["getPetRegions", getPetRegionsSaga],
["updatePet", updatePetSaga],
+ ["updatePetRegions", updatePetRegionsSaga],
["updatePetWithForm", updatePetWithFormSaga],
["uploadFile", uploadFileSaga],
]
@@ -180,7 +185,7 @@ export function *findPetsByIdsSagaImp(_action_: Action) {
yield put(findPetsByIdsRequest(requestPayload));
const response: Required> = yield apiCall(Api.petApi, Api.petApi.findPetsByIds,
- ids.map(p => parseFloat(p)).toArray(),
+ ids.map(p => (p ? parseFloat(p) : null) as number ).toArray(),
);
let successReturnValue: any = undefined;
@@ -339,7 +344,7 @@ export function *findPetsByUserIdsSagaImp(_action_: Action = yield apiCall(Api.petApi, Api.petApi.findPetsByUserIds,
- ids.map(p => parseFloat(p)).toArray(),
+ ids.map(p => (p ? parseFloat(p) : null) as number ).toArray(),
);
let successReturnValue: any = undefined;
@@ -414,6 +419,50 @@ export function *getPetByIdSagaImp(_action_: Action) {
}
}
//endregion
+//region getPetRegions
+
+export interface PayloadGetPetRegions extends PayloadGetPetRegionsRequest, BasePayloadApiAction {
+}
+
+export interface PayloadGetPetRegionsRequest {
+ petId: string;
+}
+
+export const getPetRegionsRequest = createSagaAction("getPetRegionsRequest");
+export const getPetRegionsSuccess = createSagaAction>>("getPetRegionsSuccess");
+export const getPetRegionsFailure = createSagaAction<{error: any, requestPayload: PayloadGetPetRegions}>("getPetRegionsFailure");
+
+export const getPetRegions = createSagaAction("getPetRegions");
+
+export function *getPetRegionsSaga() {
+ yield takeLatest(getPetRegions, getPetRegionsSagaImp);
+}
+
+export function *getPetRegionsSagaImp(_action_: Action) {
+ const {markErrorsAsHandled, ..._payloadRest_} = _action_.payload;
+ try {
+ const {
+ petId,
+ } = _payloadRest_;
+
+ yield put(getPetRegionsRequest(_action_.payload));
+
+ const response: Required = yield apiCall(Api.petApi, Api.petApi.getPetRegions,
+ parseFloat(petId),
+ );
+
+ let successReturnValue: any = undefined;
+ successReturnValue = petRegionsResponseRecordUtils.fromApiPassthrough(response);
+ yield put(getPetRegionsSuccess(successReturnValue));
+
+ return successReturnValue;
+ } catch (error) {
+ if (markErrorsAsHandled) {error.wasHandled = true; }
+ yield put(getPetRegionsFailure({error, requestPayload: _action_.payload}));
+ return error;
+ }
+}
+//endregion
//region updatePet
export interface PayloadUpdatePet extends PayloadUpdatePetRequest, BasePayloadApiAction {
@@ -456,6 +505,53 @@ export function *updatePetSagaImp(_action_: Action) {
}
}
//endregion
+//region updatePetRegions
+
+export interface PayloadUpdatePetRegions extends PayloadUpdatePetRegionsRequest, BasePayloadApiAction {
+}
+
+export interface PayloadUpdatePetRegionsRequest {
+ petId: string;
+ newRegions: List>;
+}
+
+export const updatePetRegionsRequest = createSagaAction("updatePetRegionsRequest");
+export const updatePetRegionsSuccess = createSagaAction>>("updatePetRegionsSuccess");
+export const updatePetRegionsFailure = createSagaAction<{error: any, requestPayload: PayloadUpdatePetRegions}>("updatePetRegionsFailure");
+
+export const updatePetRegions = createSagaAction("updatePetRegions");
+
+export function *updatePetRegionsSaga() {
+ yield takeLatest(updatePetRegions, updatePetRegionsSagaImp);
+}
+
+export function *updatePetRegionsSagaImp(_action_: Action) {
+ const {markErrorsAsHandled, ..._payloadRest_} = _action_.payload;
+ try {
+ const {
+ petId,
+ newRegions,
+ } = _payloadRest_;
+
+ yield put(updatePetRegionsRequest(_action_.payload));
+
+ const response: Required = yield apiCall(Api.petApi, Api.petApi.updatePetRegions,
+ parseFloat(petId),
+ newRegions.map(p => p.toArray().map(p2 => (p2 ? parseFloat(p2) : null) as number)).toArray(),
+ );
+
+ let successReturnValue: any = undefined;
+ successReturnValue = petRegionsResponseRecordUtils.fromApiPassthrough(response);
+ yield put(updatePetRegionsSuccess(successReturnValue));
+
+ return successReturnValue;
+ } catch (error) {
+ if (markErrorsAsHandled) {error.wasHandled = true; }
+ yield put(updatePetRegionsFailure({error, requestPayload: _action_.payload}));
+ return error;
+ }
+}
+//endregion
//region updatePetWithForm
export interface PayloadUpdatePetWithForm extends PayloadUpdatePetWithFormRequest, BasePayloadApiAction {
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/SagaApiManager.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/SagaApiManager.ts
index 21a49677e50..2738f38028e 100644
--- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/SagaApiManager.ts
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/SagaApiManager.ts
@@ -18,15 +18,7 @@ export class Api {
public static storeApi: StoreApi;
public static userApi: UserApi;
- public static init(apiBasePath: string) {
- const apiBaseConfig: ConfigurationParameters = {
- basePath: apiBasePath,
- credentials: "include",
- headers: {
- 'Cache-Control': 'no-cache, no-store' // this is needed to prevent stalling issues in Chrome. Also it is a good behavior for api calls.
- }
- };
-
+ public static init(apiBaseConfig: ConfigurationParameters) {
Api.behaviorApi = new BehaviorApi(new Configuration(apiBaseConfig));
Api.petApi = new PetApi(new Configuration(apiBaseConfig));
Api.petPartApi = new PetPartApi(new Configuration(apiBaseConfig));
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts
index 46b07183de4..85c14668d0c 100644
--- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts
@@ -281,7 +281,7 @@ export class UserApi extends runtime.BaseAPI {
* Logs out current logged in user session
*/
async logoutUser(initOverrides?: RequestInit): Promise {
- await this.logoutUserRaw(, initOverrides);
+ await this.logoutUserRaw(initOverrides);
}
/**
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/CategoryRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/CategoryRecord.ts
index f69d536f6ea..6327071c4ee 100644
--- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/CategoryRecord.ts
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/CategoryRecord.ts
@@ -61,6 +61,7 @@ class CategoryRecordUtils extends ApiRecordUtils {
public *toInlined(entityId?: string | null) {
if (!entityId) {return undefined; }
+ // @ts-ignore
const entity = yield select(apiEntityCategorySelector, {id: entityId});
if (!entity) {return undefined; }
@@ -82,6 +83,7 @@ class CategoryRecordUtils extends ApiRecordUtils {
if (!entityIds) {return null; }
let entities = List();
for (let entityIndex = 0; entityIndex < entityIds.count(); entityIndex++) {
+ // @ts-ignore
const entity = yield call(this.toInlined, entityIds.get(entityIndex));
if (entity) {
entities.push(entity);
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetRegionsResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetRegionsResponse.ts
new file mode 100644
index 00000000000..0bf9c2f561c
--- /dev/null
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetRegionsResponse.ts
@@ -0,0 +1,72 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+import { exists, mapValues } from '../runtime';
+import {
+ ResponseMeta,
+ ResponseMetaFromJSON,
+ ResponseMetaFromJSONTyped,
+ ResponseMetaToJSON,
+} from './';
+
+/**
+ *
+ * @export
+ * @interface GetPetRegionsResponse
+ */
+export interface GetPetRegionsResponse {
+ /**
+ *
+ * @type {ResponseMeta}
+ * @memberof GetPetRegionsResponse
+ */
+ meta: ResponseMeta;
+ /**
+ * An array of all 15-minute time slots in 24 hours.
+ * @type {Array>}
+ * @memberof GetPetRegionsResponse
+ */
+ data?: Array>;
+}
+
+export function GetPetRegionsResponseFromJSON(json: any): GetPetRegionsResponse {
+ return GetPetRegionsResponseFromJSONTyped(json, false);
+}
+
+export function GetPetRegionsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetPetRegionsResponse {
+ if ((json === undefined) || (json === null)) {
+ return json;
+ }
+ return {
+
+ 'meta': ResponseMetaFromJSON(json['meta']),
+ 'data': !exists(json, 'data') ? undefined : json['data'],
+ };
+}
+
+export function GetPetRegionsResponseToJSON(value?: GetPetRegionsResponse | null): any {
+ if (value === undefined) {
+ return undefined;
+ }
+ if (value === null) {
+ return null;
+ }
+ return {
+
+ 'meta': ResponseMetaToJSON(value.meta),
+ 'data': value.data,
+ };
+}
+
+
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetRegionsResponseRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetRegionsResponseRecord.ts
new file mode 100644
index 00000000000..85082fa01a4
--- /dev/null
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetRegionsResponseRecord.ts
@@ -0,0 +1,74 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+import {ApiRecordUtils, knownRecordFactories, appFromJS, NormalizedRecordEntities} from "../runtimeSagasAndRecords";
+import {getApiEntitiesState} from "../ApiEntitiesSelectors"
+import {List, Record, RecordOf, Map} from 'immutable';
+import {Schema, schema, NormalizedSchema} from "normalizr";
+import {select, call} from "redux-saga/effects";
+
+import {
+ GetPetRegionsResponse,
+} from './GetPetRegionsResponse';
+
+import {
+ ResponseMeta,
+} from './ResponseMeta';
+
+import {
+ ResponseMetaRecord,
+ responseMetaRecordUtils
+} from './ResponseMetaRecord';
+
+export const GetPetRegionsResponseRecordProps = {
+ recType: "GetPetRegionsResponseApiRecord" as "GetPetRegionsResponseApiRecord",
+ meta: ResponseMetaRecord(),
+ data: null as List> | null,
+};
+
+export type GetPetRegionsResponseRecordPropsType = typeof GetPetRegionsResponseRecordProps;
+export const GetPetRegionsResponseRecord = Record(GetPetRegionsResponseRecordProps, GetPetRegionsResponseRecordProps.recType);
+export type GetPetRegionsResponseRecord = RecordOf;
+
+knownRecordFactories.set(GetPetRegionsResponseRecordProps.recType, GetPetRegionsResponseRecord);
+
+
+class GetPetRegionsResponseRecordUtils extends ApiRecordUtils {
+ public normalize(apiObject: GetPetRegionsResponse, asEntity?: boolean): GetPetRegionsResponse {
+ (apiObject as any).recType = GetPetRegionsResponseRecordProps.recType;
+ responseMetaRecordUtils.normalize(apiObject.meta);
+ if (apiObject.data) { (apiObject as any).data = apiObject.data.map(item => item.map(item2 => item2?.toString())); }
+ return apiObject;
+ }
+
+ public toApi(record: GetPetRegionsResponseRecord): GetPetRegionsResponse {
+ const apiObject = super.toApi(record);
+ apiObject.meta = responseMetaRecordUtils.toApi(record.meta);
+ if (record.data) { apiObject.data = record.data.map(item => item.toArray().map(item2 => (item2 ? parseFloat(item2) : null) as number)).toArray(); }
+ return apiObject;
+ }
+
+ public fromApiPassthrough(apiObject: GetPetRegionsResponse): List> {
+ return appFromJS(apiObject.data);
+ }
+
+ public fromApiPassthroughAsEntities(apiObject: GetPetRegionsResponse): NormalizedRecordEntities {
+ console.log("entities revival not supported on this response");
+ return {entities: {}, result: List()};
+ }
+}
+
+export const getPetRegionsResponseRecordUtils = new GetPetRegionsResponseRecordUtils();
+
+
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/OrderRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/OrderRecord.ts
index 621b298df80..9422abd83ec 100644
--- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/OrderRecord.ts
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/OrderRecord.ts
@@ -66,6 +66,7 @@ class OrderRecordUtils extends ApiRecordUtils {
public *toInlined(entityId?: string | null) {
if (!entityId) {return undefined; }
+ // @ts-ignore
const entity = yield select(apiEntityOrderSelector, {id: entityId});
if (!entity) {return undefined; }
@@ -87,6 +88,7 @@ class OrderRecordUtils extends ApiRecordUtils {
if (!entityIds) {return null; }
let entities = List();
for (let entityIndex = 0; entityIndex < entityIds.count(); entityIndex++) {
+ // @ts-ignore
const entity = yield call(this.toInlined, entityIds.get(entityIndex));
if (entity) {
entities.push(entity);
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts
index 52488a844be..2b59b900171 100644
--- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts
@@ -158,6 +158,12 @@ export interface Pet {
* @memberof Pet
*/
status: PetStatusEnum;
+ /**
+ * An array of all 15-minute time slots in 24 hours.
+ * @type {Array>}
+ * @memberof Pet
+ */
+ regions?: Array>;
}
/**
@@ -200,6 +206,7 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet {
'tags': ((json['tags'] as Array).map(TagFromJSON)),
'optionalTags': !exists(json, 'optionalTags') ? undefined : ((json['optionalTags'] as Array).map(TagFromJSON)),
'status': json['status'],
+ 'regions': !exists(json, 'regions') ? undefined : json['regions'],
};
}
@@ -232,6 +239,7 @@ export function PetToJSON(value?: Pet | null): any {
'tags': ((value.tags as Array).map(TagToJSON)),
'optionalTags': value.optionalTags === undefined ? undefined : ((value.optionalTags as Array).map(TagToJSON)),
'status': value.status,
+ 'regions': value.regions,
};
}
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRecord.ts
index 8292c5ee074..5cb401603d8 100644
--- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRecord.ts
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRecord.ts
@@ -67,6 +67,7 @@ export const PetRecordProps = {
tags: (TagRecord(), List()),
optionalTags: (TagRecord(), null as List | null),
status: PetStatusEnum.Pending,
+ regions: null as List> | null,
};
export type PetRecordPropsType = typeof PetRecordProps;
@@ -96,12 +97,13 @@ class PetRecordUtils extends ApiRecordUtils {
(apiObject as any).recType = asEntity ? PetRecordEntityProps.recType : PetRecordProps.recType;
(apiObject as any).id = apiObject.id.toString();
if (apiObject.friendId) { (apiObject as any).friendId = apiObject.friendId.toString(); }
- (apiObject as any).otherFriendIds = apiObject.otherFriendIds.map(item => item.toString());
+ (apiObject as any).otherFriendIds = apiObject.otherFriendIds.map(item => item?.toString());
categoryRecordUtils.normalize(apiObject.category);
if (apiObject.optionalCategory) { categoryRecordUtils.normalize(apiObject.optionalCategory); }
if (apiObject._entries) { categoryRecordUtils.normalizeArray(apiObject._entries); }
tagRecordUtils.normalizeArray(apiObject.tags);
if (apiObject.optionalTags) { tagRecordUtils.normalizeArray(apiObject.optionalTags); }
+ if (apiObject.regions) { (apiObject as any).regions = apiObject.regions.map(item => item.map(item2 => item2?.toString())); }
return apiObject;
}
@@ -117,6 +119,7 @@ class PetRecordUtils extends ApiRecordUtils {
public *toInlined(entityId?: string | null) {
if (!entityId) {return undefined; }
+ // @ts-ignore
const entity = yield select(apiEntityPetSelector, {id: entityId});
if (!entity) {return undefined; }
@@ -131,10 +134,15 @@ class PetRecordUtils extends ApiRecordUtils {
} = entity;
const entityProperties = {
+ // @ts-ignore
category: yield call(categoryRecordUtils.toInlined, entity.category),
+ // @ts-ignore
optionalCategory: entity.optionalCategory ? yield call(categoryRecordUtils.toInlined, entity.optionalCategory) : null,
+ // @ts-ignore
_entries: entity._entries ? yield call(categoryRecordUtils.toInlinedArray, entity._entries) : null,
+ // @ts-ignore
tags: yield call(tagRecordUtils.toInlinedArray, entity.tags),
+ // @ts-ignore
optionalTags: entity.optionalTags ? yield call(tagRecordUtils.toInlinedArray, entity.optionalTags) : null,
}
@@ -148,6 +156,7 @@ class PetRecordUtils extends ApiRecordUtils {
if (!entityIds) {return null; }
let entities = List();
for (let entityIndex = 0; entityIndex < entityIds.count(); entityIndex++) {
+ // @ts-ignore
const entity = yield call(this.toInlined, entityIds.get(entityIndex));
if (entity) {
entities.push(entity);
@@ -160,12 +169,13 @@ class PetRecordUtils extends ApiRecordUtils {
const apiObject = super.toApi(record);
apiObject.id = parseFloat(record.id);
if (record.friendId) { apiObject.friendId = parseFloat(record.friendId); }
- apiObject.otherFriendIds = record.otherFriendIds.map(item => parseFloat(item)).toArray();
+ apiObject.otherFriendIds = record.otherFriendIds.map(item => (item ? parseFloat(item) : null) as number).toArray();
apiObject.category = categoryRecordUtils.toApi(record.category);
if (record.optionalCategory) { apiObject.optionalCategory = categoryRecordUtils.toApi(record.optionalCategory); }
if (record._entries) { apiObject._entries = categoryRecordUtils.toApiArray(record._entries); }
apiObject.tags = tagRecordUtils.toApiArray(record.tags);
if (record.optionalTags) { apiObject.optionalTags = tagRecordUtils.toApiArray(record.optionalTags); }
+ if (record.regions) { apiObject.regions = record.regions.map(item => item.toArray().map(item2 => (item2 ? parseFloat(item2) : null) as number)).toArray(); }
return apiObject;
}
}
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts
new file mode 100644
index 00000000000..7b4c268864d
--- /dev/null
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts
@@ -0,0 +1,71 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+import { exists, mapValues } from '../runtime';
+import {
+ ResponseMeta,
+ ResponseMetaFromJSON,
+ ResponseMetaFromJSONTyped,
+ ResponseMetaToJSON,
+} from './';
+
+/**
+ *
+ * @export
+ * @interface PetRegionsResponse
+ */
+export interface PetRegionsResponse {
+ /**
+ *
+ * @type {ResponseMeta}
+ * @memberof PetRegionsResponse
+ */
+ meta: ResponseMeta;
+ /**
+ * An array of all 15-minute time slots in 24 hours.
+ * @type {Array>}
+ * @memberof PetRegionsResponse
+ */
+ data?: Array>;
+}
+
+export function PetRegionsResponseFromJSON(json: any): PetRegionsResponse {
+ return PetRegionsResponseFromJSONTyped(json, false);
+}
+
+export function PetRegionsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): PetRegionsResponse {
+ if ((json === undefined) || (json === null)) {
+ return json;
+ }
+ return {
+
+ 'meta': ResponseMetaFromJSON(json['meta']),
+ 'data': !exists(json, 'data') ? undefined : json['data'],
+ };
+}
+
+export function PetRegionsResponseToJSON(value?: PetRegionsResponse | null): any {
+ if (value === undefined) {
+ return undefined;
+ }
+ if (value === null) {
+ return null;
+ }
+ return {
+
+ 'meta': ResponseMetaToJSON(value.meta),
+ 'data': value.data,
+ };
+}
+
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponseRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponseRecord.ts
new file mode 100644
index 00000000000..a56180207a5
--- /dev/null
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponseRecord.ts
@@ -0,0 +1,74 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+import {ApiRecordUtils, knownRecordFactories, appFromJS, NormalizedRecordEntities} from "../runtimeSagasAndRecords";
+import {getApiEntitiesState} from "../ApiEntitiesSelectors"
+import {List, Record, RecordOf, Map} from 'immutable';
+import {Schema, schema, NormalizedSchema} from "normalizr";
+import {select, call} from "redux-saga/effects";
+
+import {
+ PetRegionsResponse,
+} from './PetRegionsResponse';
+
+import {
+ ResponseMeta,
+} from './ResponseMeta';
+
+import {
+ ResponseMetaRecord,
+ responseMetaRecordUtils
+} from './ResponseMetaRecord';
+
+export const PetRegionsResponseRecordProps = {
+ recType: "PetRegionsResponseApiRecord" as "PetRegionsResponseApiRecord",
+ meta: ResponseMetaRecord(),
+ data: null as List> | null,
+};
+
+export type PetRegionsResponseRecordPropsType = typeof PetRegionsResponseRecordProps;
+export const PetRegionsResponseRecord = Record(PetRegionsResponseRecordProps, PetRegionsResponseRecordProps.recType);
+export type PetRegionsResponseRecord = RecordOf;
+
+knownRecordFactories.set(PetRegionsResponseRecordProps.recType, PetRegionsResponseRecord);
+
+
+class PetRegionsResponseRecordUtils extends ApiRecordUtils {
+ public normalize(apiObject: PetRegionsResponse, asEntity?: boolean): PetRegionsResponse {
+ (apiObject as any).recType = PetRegionsResponseRecordProps.recType;
+ responseMetaRecordUtils.normalize(apiObject.meta);
+ if (apiObject.data) { (apiObject as any).data = apiObject.data.map(item => item.map(item2 => item2?.toString())); }
+ return apiObject;
+ }
+
+ public toApi(record: PetRegionsResponseRecord): PetRegionsResponse {
+ const apiObject = super.toApi(record);
+ apiObject.meta = responseMetaRecordUtils.toApi(record.meta);
+ if (record.data) { apiObject.data = record.data.map(item => item.toArray().map(item2 => (item2 ? parseFloat(item2) : null) as number)).toArray(); }
+ return apiObject;
+ }
+
+ public fromApiPassthrough(apiObject: PetRegionsResponse): List> {
+ return appFromJS(apiObject.data);
+ }
+
+ public fromApiPassthroughAsEntities(apiObject: PetRegionsResponse): NormalizedRecordEntities {
+ console.log("entities revival not supported on this response");
+ return {entities: {}, result: List()};
+ }
+}
+
+export const petRegionsResponseRecordUtils = new PetRegionsResponseRecordUtils();
+
+
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/TagRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/TagRecord.ts
index dd3b631ac85..b14cd7e7195 100644
--- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/TagRecord.ts
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/TagRecord.ts
@@ -61,6 +61,7 @@ class TagRecordUtils extends ApiRecordUtils {
public *toInlined(entityId?: string | null) {
if (!entityId) {return undefined; }
+ // @ts-ignore
const entity = yield select(apiEntityTagSelector, {id: entityId});
if (!entity) {return undefined; }
@@ -82,6 +83,7 @@ class TagRecordUtils extends ApiRecordUtils {
if (!entityIds) {return null; }
let entities = List();
for (let entityIndex = 0; entityIndex < entityIds.count(); entityIndex++) {
+ // @ts-ignore
const entity = yield call(this.toInlined, entityIds.get(entityIndex));
if (entity) {
entities.push(entity);
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/UserRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/UserRecord.ts
index 292519c32b2..0d892e64a75 100644
--- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/UserRecord.ts
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/UserRecord.ts
@@ -69,6 +69,7 @@ class UserRecordUtils extends ApiRecordUtils {
public *toInlined(entityId?: string | null) {
if (!entityId) {return undefined; }
+ // @ts-ignore
const entity = yield select(apiEntityUserSelector, {id: entityId});
if (!entity) {return undefined; }
@@ -90,6 +91,7 @@ class UserRecordUtils extends ApiRecordUtils {
if (!entityIds) {return null; }
let entities = List();
for (let entityIndex = 0; entityIndex < entityIds.count(); entityIndex++) {
+ // @ts-ignore
const entity = yield call(this.toInlined, entityIds.get(entityIndex));
if (entity) {
entities.push(entity);
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/index.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/index.ts
index b4f59662cbc..aac3503a1f5 100644
--- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/index.ts
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/index.ts
@@ -34,6 +34,8 @@ export * from './PartRecord';
export * from './Pet';
export * from './PetRecord';
export * from './PetPartType';
+export * from './PetRegionsResponse';
+export * from './PetRegionsResponseRecord';
export * from './ResponseMeta';
export * from './ResponseMetaRecord';
export * from './Tag';
From 1c38bfd5a03162a230bab8a7ae3529f99655fb7f Mon Sep 17 00:00:00 2001
From: William Cheng
Date: Wed, 27 Oct 2021 23:42:46 +0800
Subject: [PATCH 11/25] update microprofile to newer version (#10714)
---
.../main/resources/Java/libraries/microprofile/pom.mustache | 4 ++--
samples/client/petstore/java/microprofile-rest-client/pom.xml | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache
index 642e02c21c3..3d5f941907b 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache
@@ -77,7 +77,7 @@
org.eclipse.microprofile.rest.client
microprofile-rest-client-api
- 1.2.1
+ 1.4.1
@@ -189,7 +189,7 @@
{{/useBeanValidation}}
3.2.7
2.9.7
- 1.2.2
+ 1.2.2
1.3.5
1.0.2
1.1.6
diff --git a/samples/client/petstore/java/microprofile-rest-client/pom.xml b/samples/client/petstore/java/microprofile-rest-client/pom.xml
index 39b65989001..2050156fe40 100644
--- a/samples/client/petstore/java/microprofile-rest-client/pom.xml
+++ b/samples/client/petstore/java/microprofile-rest-client/pom.xml
@@ -66,7 +66,7 @@
org.eclipse.microprofile.rest.client
microprofile-rest-client-api
- 1.2.1
+ 1.4.1
@@ -157,7 +157,7 @@
1.2.0
3.2.7
2.9.7
- 1.2.2
+ 1.2.2
1.3.5
1.0.2
1.1.6
From d1b61bdc04d554275bcb0d3b23e17ef3b2e208d2 Mon Sep 17 00:00:00 2001
From: Justin Black
Date: Wed, 27 Oct 2021 14:16:53 -0700
Subject: [PATCH 12/25] adds get/setHasMultipleTypes to Java schema classes
(#10715)
* Adds getter and setter for hasMultipleTypes and implements it in CodegenModel
* Adds getter and setter to CodegenProperty
* Updates CodegenParameter
* Updates CodegenResponse
* Samples regenerated
---
.../org/openapitools/codegen/CodegenModel.java | 11 ++++++++++-
.../org/openapitools/codegen/CodegenParameter.java | 14 ++++++++++++--
.../org/openapitools/codegen/CodegenProperty.java | 11 ++++++++++-
.../org/openapitools/codegen/CodegenResponse.java | 11 ++++++++++-
.../codegen/IJsonSchemaValidationProperties.java | 3 +++
.../openapitools/handler/PathHandlerInterface.java | 4 ++--
6 files changed, 47 insertions(+), 7 deletions(-)
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
index e09c32c96b2..0a44812ceac 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
@@ -106,6 +106,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public Map vendorExtensions = new HashMap();
private CodegenComposedSchemas composedSchemas;
+ private boolean hasMultipleTypes = false;
/**
* The type of the value for the additionalProperties keyword in the OAS document.
@@ -816,6 +817,12 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
return composedSchemas;
}
+ @Override
+ public boolean getHasMultipleTypes() {return hasMultipleTypes; }
+
+ @Override
+ public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -849,6 +856,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
hasOnlyReadOnly == that.hasOnlyReadOnly &&
isNull == that.isNull &&
hasValidation == that.hasValidation &&
+ hasMultipleTypes == that.getHasMultipleTypes() &&
hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() &&
getIsAnyType() == that.getIsAnyType() &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
@@ -926,7 +934,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
getMinItems(), getMaxLength(), getMinLength(), getExclusiveMinimum(), getExclusiveMaximum(), getMinimum(),
getMaximum(), getPattern(), getMultipleOf(), getItems(), getAdditionalProperties(), getIsModel(),
getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping,
- isAnyType, getComposedSchemas());
+ isAnyType, getComposedSchemas(), hasMultipleTypes);
}
@Override
@@ -1019,6 +1027,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
sb.append(", getIsAnyType=").append(getIsAnyType());
sb.append(", composedSchemas=").append(composedSchemas);
+ sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
sb.append('}');
return sb.toString();
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
index e0f962215df..38eb785410e 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
@@ -108,6 +108,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
private boolean hasRequired;
private boolean hasDiscriminatorWithNonEmptyMapping;
private CodegenComposedSchemas composedSchemas;
+ private boolean hasMultipleTypes = false;
public CodegenParameter copy() {
CodegenParameter output = new CodegenParameter();
@@ -159,6 +160,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
output.setHasVars(this.hasVars);
output.setHasRequired(this.hasRequired);
output.setHasDiscriminatorWithNonEmptyMapping(this.hasDiscriminatorWithNonEmptyMapping);
+ output.setHasMultipleTypes(this.hasMultipleTypes);
if (this.composedSchemas != null) {
output.setComposedSchemas(this.getComposedSchemas());
@@ -220,7 +222,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
@Override
public int hashCode() {
- return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping, composedSchemas);
+ return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes);
}
@Override
@@ -268,8 +270,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
isDeprecated == that.isDeprecated &&
required == that.required &&
isNull == that.isNull &&
- hasDiscriminatorWithNonEmptyMapping && that.getHasDiscriminatorWithNonEmptyMapping() &&
+ hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
+ hasMultipleTypes == that.getHasMultipleTypes() &&
getHasVars() == that.getHasVars() &&
getHasRequired() == that.getHasRequired() &&
getExclusiveMaximum() == that.getExclusiveMaximum() &&
@@ -399,6 +402,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
sb.append(", getHasRequired=").append(hasRequired);
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
sb.append(", composedSchemas=").append(composedSchemas);
+ sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
sb.append('}');
return sb.toString();
}
@@ -722,5 +726,11 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
public CodegenComposedSchemas getComposedSchemas() {
return composedSchemas;
}
+
+ @Override
+ public boolean getHasMultipleTypes() {return hasMultipleTypes; }
+
+ @Override
+ public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
index e326a052fca..c7a22915dbf 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
@@ -192,6 +192,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
private boolean hasRequired;
private boolean hasDiscriminatorWithNonEmptyMapping;
private CodegenComposedSchemas composedSchemas = null;
+ private boolean hasMultipleTypes = false;
public String getBaseName() {
return baseName;
@@ -801,6 +802,12 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
this.isAnyType = isAnyType;
}
+ @Override
+ public boolean getHasMultipleTypes() {return hasMultipleTypes; }
+
+ @Override
+ public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
+
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenProperty{");
@@ -897,6 +904,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
sb.append(", getHasRequired=").append(getHasRequired());
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
sb.append(", composedSchemas=").append(composedSchemas);
+ sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
sb.append('}');
return sb.toString();
}
@@ -948,6 +956,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
isXmlAttribute == that.isXmlAttribute &&
isXmlWrapped == that.isXmlWrapped &&
isNull == that.isNull &&
+ hasMultipleTypes == that.getHasMultipleTypes() &&
hasDiscriminatorWithNonEmptyMapping == that.hasDiscriminatorWithNonEmptyMapping &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getHasVars() == that.getHasVars() &&
@@ -1015,6 +1024,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
vendorExtensions, hasValidation, isInherited, discriminatorValue, nameInCamelCase,
nameInSnakeCase, enumName, maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName,
xmlNamespace, isXmlWrapped, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired,
- hasDiscriminatorWithNonEmptyMapping, composedSchemas);
+ hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes);
}
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java
index 545628931c7..b81bda5f583 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java
@@ -86,6 +86,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
private boolean hasRequired;
private boolean hasDiscriminatorWithNonEmptyMapping;
private CodegenComposedSchemas composedSchemas;
+ private boolean hasMultipleTypes = false;
@Override
public int hashCode() {
@@ -97,7 +98,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(),
getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(),
is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired,
- hasDiscriminatorWithNonEmptyMapping, composedSchemas);
+ hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes);
}
@Override
@@ -142,6 +143,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
is4xx == that.is4xx &&
is5xx == that.is5xx &&
hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() &&
+ hasMultipleTypes == that.getHasMultipleTypes() &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getHasVars() == that.getHasVars() &&
getHasRequired() == that.getHasRequired() &&
@@ -485,6 +487,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
sb.append(", getHasRequired=").append(hasRequired);
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
sb.append(", composedSchemas=").append(composedSchemas);
+ sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
sb.append('}');
return sb.toString();
}
@@ -583,4 +586,10 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
public CodegenComposedSchemas getComposedSchemas() {
return composedSchemas;
}
+
+ @Override
+ public boolean getHasMultipleTypes() {return hasMultipleTypes; }
+
+ @Override
+ public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java
index fe80c549ac6..eb95821d6f3 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java
@@ -149,6 +149,9 @@ public interface IJsonSchemaValidationProperties {
void setComposedSchemas(CodegenComposedSchemas composedSchemas);
+ boolean getHasMultipleTypes();
+
+ void setHasMultipleTypes(boolean hasMultipleTypes);
/**
* Syncs all the schema's type properties into the IJsonSchemaValidationProperties instance
diff --git a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java
index 70d25fdaee1..3f538dd91f3 100644
--- a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java
+++ b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java
@@ -539,10 +539,10 @@ public interface PathHandlerInterface {
* Response headers: [CodegenProperty{openApiType='integer', baseName='X-Rate-Limit', complexType='null', getter='getxRateLimit', setter='setxRateLimit', description='calls per hour allowed by the user', dataType='Integer', datatypeWithEnum='Integer', dataFormat='int32', name='xRateLimit', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Rate-Limit;', baseType='Integer', containerType='null', title='null', unescapedDescription='calls per hour allowed by the user', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{
"type" : "integer",
"format" : "int32"
-}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=true, isModel=false, isContainer=false, isString=false, isNumeric=true, isInteger=true, isShort=true, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XRateLimit', nameInSnakeCase='X_RATE_LIMIT', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false, composedSchemas=null}, CodegenProperty{openApiType='string', baseName='X-Expires-After', complexType='Date', getter='getxExpiresAfter', setter='setxExpiresAfter', description='date in UTC when token expires', dataType='Date', datatypeWithEnum='Date', dataFormat='date-time', name='xExpiresAfter', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Expires-After;', baseType='Date', containerType='null', title='null', unescapedDescription='date in UTC when token expires', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{
+}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=true, isModel=false, isContainer=false, isString=false, isNumeric=true, isInteger=true, isShort=true, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XRateLimit', nameInSnakeCase='X_RATE_LIMIT', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false, composedSchemas=null, hasMultipleTypes=false}, CodegenProperty{openApiType='string', baseName='X-Expires-After', complexType='Date', getter='getxExpiresAfter', setter='setxExpiresAfter', description='date in UTC when token expires', dataType='Date', datatypeWithEnum='Date', dataFormat='date-time', name='xExpiresAfter', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Expires-After;', baseType='Date', containerType='null', title='null', unescapedDescription='date in UTC when token expires', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{
"type" : "string",
"format" : "date-time"
-}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=false, isModel=false, isContainer=false, isString=false, isNumeric=false, isInteger=false, isShort=false, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=true, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XExpiresAfter', nameInSnakeCase='X_EXPIRES_AFTER', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false, composedSchemas=null}]
+}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=false, isModel=false, isContainer=false, isString=false, isNumeric=false, isInteger=false, isShort=false, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=true, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XExpiresAfter', nameInSnakeCase='X_EXPIRES_AFTER', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false, composedSchemas=null, hasMultipleTypes=false}]
*
* Produces: [{mediaType=application/xml}, {mediaType=application/json}]
* Returns: {@link String}
From bf7757093466389fe29ab0f78cd9f8ec1b19d478 Mon Sep 17 00:00:00 2001
From: Sergii Baitala
Date: Fri, 29 Oct 2021 04:58:29 +0300
Subject: [PATCH 13/25] [cpprestsdk] CMake build system improvements (#10660)
* cmake install support
* fix option overriding issue
* fix alignment
---
bin/configs/cpp-restsdk-client.yaml | 2 +
docs/generators/cpp-restsdk.md | 1 +
.../languages/CppRestSdkClientCodegen.java | 12 +-
.../cpp-rest-sdk-client/api-header.mustache | 5 +-
.../cpp-rest-sdk-client/cmake-config.mustache | 5 +
.../cpp-rest-sdk-client/cmake-lists.mustache | 106 ++++++++++--------
.../cpp-rest-sdk-client/model-header.mustache | 2 +-
.../petstore/cpp-restsdk/CMakeLists.txt | 62 +++-------
.../client/.openapi-generator/FILES | 1 +
.../cpp-restsdk/client/CMakeLists.txt | 106 ++++++++++--------
.../cpp-restsdk/client/Config.cmake.in | 5 +
.../petstore/cpp-restsdk/client/api/PetApi.h | 9 +-
.../cpp-restsdk/client/api/StoreApi.h | 7 +-
.../petstore/cpp-restsdk/client/api/UserApi.h | 7 +-
.../cpp-restsdk/client/model/ApiResponse.h | 2 +-
.../cpp-restsdk/client/model/Category.h | 2 +-
.../petstore/cpp-restsdk/client/model/Order.h | 2 +-
.../petstore/cpp-restsdk/client/model/Pet.h | 6 +-
.../petstore/cpp-restsdk/client/model/Tag.h | 2 +-
.../petstore/cpp-restsdk/client/model/User.h | 2 +-
20 files changed, 180 insertions(+), 166 deletions(-)
create mode 100644 modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-config.mustache
create mode 100644 samples/client/petstore/cpp-restsdk/client/Config.cmake.in
diff --git a/bin/configs/cpp-restsdk-client.yaml b/bin/configs/cpp-restsdk-client.yaml
index 87bce881bbd..fedc628a69e 100644
--- a/bin/configs/cpp-restsdk-client.yaml
+++ b/bin/configs/cpp-restsdk-client.yaml
@@ -2,3 +2,5 @@ generatorName: cpp-restsdk
outputDir: samples/client/petstore/cpp-restsdk/client
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/cpp-rest-sdk-client
+additionalProperties:
+ packageName: CppRestPetstoreClient
diff --git a/docs/generators/cpp-restsdk.md b/docs/generators/cpp-restsdk.md
index 9dfbb390514..4fc97b939ae 100644
--- a/docs/generators/cpp-restsdk.md
+++ b/docs/generators/cpp-restsdk.md
@@ -12,6 +12,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|defaultInclude|The default include statement that should be placed in all headers for including things like the declspec (convention: #include "Commons.h" | ||
|generateGMocksForApis|Generate Google Mock classes for APIs.| |null|
|modelPackage|C++ namespace for models (convention: name.space.model).| |org.openapitools.client.model|
+|packageName|C++ package (library) name.| |CppRestOpenAPIClient|
|packageVersion|C++ package version.| |1.0.0|
|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_|
|variableNameFirstCharacterUppercase|Make first character of variable name uppercase (eg. value -> Value)| |true|
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java
index f6b62cdd144..a72388d4226 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java
@@ -38,10 +38,13 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
public static final String DECLSPEC = "declspec";
public static final String DEFAULT_INCLUDE = "defaultInclude";
public static final String GENERATE_GMOCKS_FOR_APIS = "generateGMocksForApis";
+ public static final String DEFAULT_PACKAGE_NAME = "CppRestOpenAPIClient";
+ protected String packageName = "";
protected String packageVersion = "1.0.0";
protected String declspec = "";
protected String defaultInclude = "";
+ protected String modelDirName = "model";
private final Set parentModels = new HashSet<>();
private final Multimap childrenByParent = ArrayListMultimap.create();
@@ -119,6 +122,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
cliOptions.clear();
// CLI options
+ addOption(CodegenConstants.PACKAGE_NAME, "C++ package (library) name.", DEFAULT_PACKAGE_NAME);
addOption(CodegenConstants.MODEL_PACKAGE, "C++ namespace for models (convention: name.space.model).",
this.modelPackage);
addOption(CodegenConstants.API_PACKAGE, "C++ namespace for apis (convention: name.space.api).",
@@ -159,6 +163,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
supportingFiles.add(new SupportingFile("cmake-lists.mustache", "", "CMakeLists.txt"));
+ supportingFiles.add(new SupportingFile("cmake-config.mustache", "", "Config.cmake.in"));
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
languageSpecificPrimitives = new HashSet(
@@ -195,6 +200,8 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
public void processOpts() {
super.processOpts();
+ packageName = (String) additionalProperties.getOrDefault(CodegenConstants.PACKAGE_NAME, DEFAULT_PACKAGE_NAME);
+
if (additionalProperties.containsKey(DECLSPEC)) {
declspec = additionalProperties.get(DECLSPEC).toString();
}
@@ -212,6 +219,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
additionalProperties.put("gmockApis", "true");
}
+ additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
additionalProperties.put("modelNamespaceDeclarations", modelPackage.split("\\."));
additionalProperties.put("modelNamespace", modelPackage.replaceAll("\\.", "::"));
additionalProperties.put("modelHeaderGuardPrefix", modelPackage.replaceAll("\\.", "_").toUpperCase(Locale.ROOT));
@@ -229,7 +237,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
*/
@Override
public String modelFileFolder() {
- return outputFolder + "/model";
+ return outputFolder + "/" + modelDirName;
}
/**
@@ -246,7 +254,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
if (importMapping.containsKey(name)) {
return importMapping.get(name);
} else {
- return "#include \"" + toModelFilename(name) + ".h\"";
+ return "#include \"" + modelDirName + "/" + toModelFilename(name) + ".h\"";
}
}
diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache
index 3b1c75e86d1..135d033f747 100644
--- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache
+++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache
@@ -9,12 +9,11 @@
#define {{apiHeaderGuardPrefix}}_{{classname}}_H_
{{{defaultInclude}}}
-#include "../ApiClient.h"
+#include "ApiClient.h"
+{{^hasModelImport}}#include "ModelBase.h"{{/hasModelImport}}
{{#imports}}{{{import}}}
{{/imports}}
-{{^hasModelImport}}#include "../ModelBase.h"{{/hasModelImport}}
-
#include
{{#apiNamespaceDeclarations}}
diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-config.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-config.mustache
new file mode 100644
index 00000000000..2a485225c0c
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-config.mustache
@@ -0,0 +1,5 @@
+@PACKAGE_INIT@
+
+include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake)
+
+check_required_components("@PROJECT_NAME@")
diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache
index b882ea0e723..71f12cad0f8 100644
--- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache
+++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache
@@ -8,69 +8,85 @@
#
# NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech).
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required (VERSION 3.1)
-#PROJECT's NAME
-project(CppRestOpenAPIClient)
-set(CMAKE_VERBOSE_MAKEFILE ON)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
+project({{{packageName}}})
-# THE LOCATION OF OUTPUT BINARIES
-set(CMAKE_LIBRARY_DIR ${PROJECT_SOURCE_DIR}/lib)
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+set(CXX_STANDARD_REQUIRED ON)
+
+if(NOT CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 14)
+endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
-# BUILD TYPE
-message("A ${CMAKE_BUILD_TYPE} build configuration is detected")
+find_package(cpprestsdk REQUIRED)
+find_package(Boost REQUIRED)
+
+include(GNUInstallDirs)
+include(CMakePackageConfigHelpers)
+
+file(GLOB_RECURSE HEADER_FILES "*.h")
+file(GLOB_RECURSE SOURCE_FILES "*.cpp")
+
+add_library(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES})
+
+target_compile_options(${PROJECT_NAME}
+ PRIVATE
+ $<$,$,$>:
+ -Wall -Wno-unused-variable>
+)
+
+target_include_directories(${PROJECT_NAME}
+ PUBLIC
+ $
+ $
+)
+
+target_link_directories(${PROJECT_NAME}
+ PRIVATE
+ ${Boost_LIBRARY_DIRS}
+)
if (UNIX)
message(STATUS "Building client library for Linux/Unix")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -Wno-unused-variable")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable")
- set(cpprestsdk_DIR /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/cmake/)
-
- find_package(cpprestsdk REQUIRED)
- find_package(Boost REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PUBLIC cpprest ${Boost_LIBRARIES} crypto)
else()
message(STATUS "Building client library for Windows")
- find_package(cpprestsdk REQUIRED)
- find_package(Boost REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PUBLIC cpprestsdk::cpprest ${Boost_LIBRARIES} bcrypt)
endif()
-# Manually set the cpprestsdk paths when not using package manager
-#set(CPPREST_INCLUDE_DIR ${CPPREST_ROOT}/include)
-#set(CPPREST_LIBRARY_DIR ${CPPREST_ROOT}/lib)
-#include_directories(${CPPREST_INCLUDE_DIR})
-#link_directories(${CPPREST_LIBRARY_DIR})
-
-#SUPPORTING FILES
-set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData" "Object")
-#SOURCE FILES
-file(GLOB SOURCE_FILES "api/*" "model/*")
-
-add_library(${PROJECT_NAME} ${SUPPORTING_FILES} ${SOURCE_FILES})
-
-target_include_directories(
- ${PROJECT_NAME} PRIVATE
- ${Boost_INCLUDE_DIRS}
- ${CMAKE_CURRENT_SOURCE_DIR}/model
- ${CMAKE_CURRENT_SOURCE_DIR}/api
+configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
+ INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
-target_link_directories(
- ${PROJECT_NAME} PRIVATE
- ${Boost_LIBRARY_DIRS}
+install(
+ TARGETS ${PROJECT_NAME}
+ EXPORT ${PROJECT_NAME}Targets
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
-if (UNIX)
- target_link_libraries(${PROJECT_NAME} PRIVATE cpprest ${Boost_LIBRARIES} crypto)
-else()
- target_link_libraries(${PROJECT_NAME} PRIVATE cpprestsdk::cpprest ${Boost_LIBRARIES} bcrypt)
-endif()
+install(
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
+ FILES_MATCHING PATTERN "*.h"
+)
-set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
-set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
+install(
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
+)
+
+install(
+ EXPORT ${PROJECT_NAME}Targets
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
+)
diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache
index f8ba4b95e7f..c67a886e915 100644
--- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache
+++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache
@@ -10,7 +10,7 @@
{{^parent}}
{{{defaultInclude}}}
-#include "../ModelBase.h"
+#include "ModelBase.h"
{{/parent}}
{{#imports}}{{{this}}}
diff --git a/samples/client/petstore/cpp-restsdk/CMakeLists.txt b/samples/client/petstore/cpp-restsdk/CMakeLists.txt
index 27ceccc45fd..93dcc141b16 100644
--- a/samples/client/petstore/cpp-restsdk/CMakeLists.txt
+++ b/samples/client/petstore/cpp-restsdk/CMakeLists.txt
@@ -1,57 +1,21 @@
-cmake_minimum_required (VERSION 3.2)
-
-project(cpprest-petstore)
-set(CMAKE_VERBOSE_MAKEFILE ON)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-if (UNIX)
- message(STATUS "Building for Linux/Unix")
-
- set(CMAKE_BUILD_TYPE Debug)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -Wno-unused-variable -pg -g3")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable -pg -g3")
-
- find_package(cpprestsdk REQUIRED)
- find_package(Boost REQUIRED)
-else()
- message(STATUS "Building for Windows")
-
- find_package(cpprestsdk REQUIRED)
- find_package(Boost REQUIRED)
- find_package(pthreads REQUIRED)
-endif()
+cmake_minimum_required (VERSION 3.1)
add_subdirectory(client)
-file(GLOB SRCS
- ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+project(cpprest-petstore)
+
+find_package(Threads REQUIRED)
+
+file(GLOB SOURCE_FILES "*.cpp")
+
+add_executable(${PROJECT_NAME} ${SOURCE_FILES})
+
+target_link_libraries(${PROJECT_NAME}
+ PRIVATE
+ CppRestPetstoreClient
+ Threads::Threads
)
-add_executable(${PROJECT_NAME} ${SRCS})
-add_dependencies(${PROJECT_NAME} CppRestOpenAPIClient )
-
-target_include_directories(
- ${PROJECT_NAME} PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}/client
- ${CMAKE_CURRENT_SOURCE_DIR}/client/model
- ${CMAKE_CURRENT_SOURCE_DIR}/client/api
- ${Boost_INCLUDE_DIRS}
-)
-
-target_link_directories(
- ${PROJECT_NAME} PRIVATE
- ${Boost_LIBRARY_DIRS}
-)
-
-if (UNIX)
- target_link_libraries(${PROJECT_NAME} PRIVATE CppRestOpenAPIClient cpprest pthread ${Boost_LIBRARIES} crypto)
-else()
- target_link_libraries(${PROJECT_NAME} PRIVATE CppRestOpenAPIClient cpprestsdk::cpprest ${pthreads_LIBRARIES} ${Boost_LIBRARIES} bcrypt)
-endif()
-
-set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
-set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
-
if (UNIX)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
endif()
diff --git a/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES
index 92e7f17c960..4935b4dc57f 100644
--- a/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES
+++ b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES
@@ -6,6 +6,7 @@ ApiConfiguration.h
ApiException.cpp
ApiException.h
CMakeLists.txt
+Config.cmake.in
HttpContent.cpp
HttpContent.h
IHttpBody.h
diff --git a/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt b/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt
index 923a3f75752..cb15320268b 100644
--- a/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt
+++ b/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt
@@ -8,69 +8,85 @@
#
# NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech).
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required (VERSION 3.1)
-#PROJECT's NAME
-project(CppRestOpenAPIClient)
-set(CMAKE_VERBOSE_MAKEFILE ON)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
+project(CppRestPetstoreClient)
-# THE LOCATION OF OUTPUT BINARIES
-set(CMAKE_LIBRARY_DIR ${PROJECT_SOURCE_DIR}/lib)
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+set(CXX_STANDARD_REQUIRED ON)
+
+if(NOT CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 14)
+endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
-# BUILD TYPE
-message("A ${CMAKE_BUILD_TYPE} build configuration is detected")
+find_package(cpprestsdk REQUIRED)
+find_package(Boost REQUIRED)
+
+include(GNUInstallDirs)
+include(CMakePackageConfigHelpers)
+
+file(GLOB_RECURSE HEADER_FILES "*.h")
+file(GLOB_RECURSE SOURCE_FILES "*.cpp")
+
+add_library(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES})
+
+target_compile_options(${PROJECT_NAME}
+ PRIVATE
+ $<$,$,$>:
+ -Wall -Wno-unused-variable>
+)
+
+target_include_directories(${PROJECT_NAME}
+ PUBLIC
+ $
+ $
+)
+
+target_link_directories(${PROJECT_NAME}
+ PRIVATE
+ ${Boost_LIBRARY_DIRS}
+)
if (UNIX)
message(STATUS "Building client library for Linux/Unix")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -Wno-unused-variable")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable")
- set(cpprestsdk_DIR /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/cmake/)
-
- find_package(cpprestsdk REQUIRED)
- find_package(Boost REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PUBLIC cpprest ${Boost_LIBRARIES} crypto)
else()
message(STATUS "Building client library for Windows")
- find_package(cpprestsdk REQUIRED)
- find_package(Boost REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PUBLIC cpprestsdk::cpprest ${Boost_LIBRARIES} bcrypt)
endif()
-# Manually set the cpprestsdk paths when not using package manager
-#set(CPPREST_INCLUDE_DIR ${CPPREST_ROOT}/include)
-#set(CPPREST_LIBRARY_DIR ${CPPREST_ROOT}/lib)
-#include_directories(${CPPREST_INCLUDE_DIR})
-#link_directories(${CPPREST_LIBRARY_DIR})
-
-#SUPPORTING FILES
-set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData" "Object")
-#SOURCE FILES
-file(GLOB SOURCE_FILES "api/*" "model/*")
-
-add_library(${PROJECT_NAME} ${SUPPORTING_FILES} ${SOURCE_FILES})
-
-target_include_directories(
- ${PROJECT_NAME} PRIVATE
- ${Boost_INCLUDE_DIRS}
- ${CMAKE_CURRENT_SOURCE_DIR}/model
- ${CMAKE_CURRENT_SOURCE_DIR}/api
+configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
+ INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
-target_link_directories(
- ${PROJECT_NAME} PRIVATE
- ${Boost_LIBRARY_DIRS}
+install(
+ TARGETS ${PROJECT_NAME}
+ EXPORT ${PROJECT_NAME}Targets
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
-if (UNIX)
- target_link_libraries(${PROJECT_NAME} PRIVATE cpprest ${Boost_LIBRARIES} crypto)
-else()
- target_link_libraries(${PROJECT_NAME} PRIVATE cpprestsdk::cpprest ${Boost_LIBRARIES} bcrypt)
-endif()
+install(
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
+ FILES_MATCHING PATTERN "*.h"
+)
-set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
-set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
+install(
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
+)
+
+install(
+ EXPORT ${PROJECT_NAME}Targets
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
+)
diff --git a/samples/client/petstore/cpp-restsdk/client/Config.cmake.in b/samples/client/petstore/cpp-restsdk/client/Config.cmake.in
new file mode 100644
index 00000000000..2a485225c0c
--- /dev/null
+++ b/samples/client/petstore/cpp-restsdk/client/Config.cmake.in
@@ -0,0 +1,5 @@
+@PACKAGE_INIT@
+
+include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake)
+
+check_required_components("@PROJECT_NAME@")
diff --git a/samples/client/petstore/cpp-restsdk/client/api/PetApi.h b/samples/client/petstore/cpp-restsdk/client/api/PetApi.h
index 5c861119be7..bfe7bc38c82 100644
--- a/samples/client/petstore/cpp-restsdk/client/api/PetApi.h
+++ b/samples/client/petstore/cpp-restsdk/client/api/PetApi.h
@@ -19,14 +19,13 @@
#define ORG_OPENAPITOOLS_CLIENT_API_PetApi_H_
-#include "../ApiClient.h"
-#include "ApiResponse.h"
+#include "ApiClient.h"
+
+#include "model/ApiResponse.h"
#include "HttpContent.h"
-#include "Pet.h"
+#include "model/Pet.h"
#include
-
-
#include
namespace org {
diff --git a/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h
index 3e60ecb4a81..ded6008b515 100644
--- a/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h
+++ b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h
@@ -19,13 +19,12 @@
#define ORG_OPENAPITOOLS_CLIENT_API_StoreApi_H_
-#include "../ApiClient.h"
-#include "Order.h"
+#include "ApiClient.h"
+
+#include "model/Order.h"
#include