diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java
index 3f5a39baf9c..7c4b9b71610 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java
@@ -109,7 +109,6 @@ public class OpenAPINormalizer {
this.inputRules = inputRules;
if (Boolean.parseBoolean(inputRules.get(DISABLE_ALL))) {
- LOGGER.info("Disabled all rules in OpenAPI Normalizer (DISABLE_ALL=true)");
this.disableAll = true;
return; // skip the rest
}
@@ -306,6 +305,11 @@ public class OpenAPINormalizer {
}
for (Parameter parameter : parameters) {
+ // dereference parameter
+ if (StringUtils.isNotEmpty(parameter.get$ref())) {
+ parameter = ModelUtils.getReferencedParameter(openAPI, parameter);
+ }
+
if (parameter.getSchema() == null) {
continue;
} else {
diff --git a/modules/openapi-generator/src/test/resources/3_1/java/petstore.yaml b/modules/openapi-generator/src/test/resources/3_1/java/petstore.yaml
index a8378849d12..d19c903652f 100644
--- a/modules/openapi-generator/src/test/resources/3_1/java/petstore.yaml
+++ b/modules/openapi-generator/src/test/resources/3_1/java/petstore.yaml
@@ -599,10 +599,30 @@ paths:
responses:
'200':
$ref: '#/components/responses/ref'
+ /ref/ref_to_parameter:
+ get:
+ operationId: ref_to_ref_parameter
+ tags:
+ - fake
+ responses:
+ '200':
+ $ref: '#/components/responses/ref'
+ parameters:
+ - $ref: '#/components/parameters/ref_to_uuid'
externalDocs:
description: Find out more about Swagger
url: 'http://swagger.io'
components:
+ parameters:
+ ref_to_uuid:
+ description: to test ref to parameter (uuid)
+ name: ref_to_uuid
+ in: header
+ required: true
+ schema:
+ type: string
+ format: uuid
+ example: 61864654-6e6b-4152-a62f-795fdd606bc2
requestBodies:
UserArray:
content:
diff --git a/samples/client/petstore/java/okhttp-gson-3.1/README.md b/samples/client/petstore/java/okhttp-gson-3.1/README.md
index f79b4cc2c79..8a4562dbc09 100644
--- a/samples/client/petstore/java/okhttp-gson-3.1/README.md
+++ b/samples/client/petstore/java/okhttp-gson-3.1/README.md
@@ -91,11 +91,12 @@ public class Example {
defaultClient.setBasePath("http://petstore.swagger.io/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
+ UUID refToUuid = UUID.fromString("61864654-6e6b-4152-a62f-795fdd606bc2"); // UUID | to test ref to parameter (uuid)
try {
- String result = apiInstance.responseNoRef();
+ String result = apiInstance.refToRefParameter(refToUuid);
System.out.println(result);
} catch (ApiException e) {
- System.err.println("Exception when calling FakeApi#responseNoRef");
+ System.err.println("Exception when calling FakeApi#refToRefParameter");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
@@ -112,6 +113,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
+*FakeApi* | [**refToRefParameter**](docs/FakeApi.md#refToRefParameter) | **GET** /ref/ref_to_parameter |
*FakeApi* | [**responseNoRef**](docs/FakeApi.md#responseNoRef) | **GET** /no_ref |
*FakeApi* | [**responseRefToNoRef**](docs/FakeApi.md#responseRefToNoRef) | **GET** /ref/no_ref |
*FakeApi* | [**responseRefToRef**](docs/FakeApi.md#responseRefToRef) | **GET** /ref/ref |
diff --git a/samples/client/petstore/java/okhttp-gson-3.1/api/openapi.yaml b/samples/client/petstore/java/okhttp-gson-3.1/api/openapi.yaml
index 0b8fd95ef7d..f6202403060 100644
--- a/samples/client/petstore/java/okhttp-gson-3.1/api/openapi.yaml
+++ b/samples/client/petstore/java/okhttp-gson-3.1/api/openapi.yaml
@@ -641,7 +641,32 @@ paths:
tags:
- fake
x-accepts: text/plain
+ /ref/ref_to_parameter:
+ get:
+ operationId: ref_to_ref_parameter
+ parameters:
+ - $ref: '#/components/parameters/ref_to_uuid'
+ responses:
+ "200":
+ $ref: '#/components/responses/ref'
+ tags:
+ - fake
+ x-accepts: text/plain
+ parameters:
+ - $ref: '#/components/parameters/ref_to_uuid'
components:
+ parameters:
+ ref_to_uuid:
+ description: to test ref to parameter (uuid)
+ explode: false
+ in: header
+ name: ref_to_uuid
+ required: true
+ schema:
+ example: 61864654-6e6b-4152-a62f-795fdd606bc2
+ format: uuid
+ type: string
+ style: simple
requestBodies:
UserArray:
content:
diff --git a/samples/client/petstore/java/okhttp-gson-3.1/docs/FakeApi.md b/samples/client/petstore/java/okhttp-gson-3.1/docs/FakeApi.md
index ac0793307ab..79da3fbb4fd 100644
--- a/samples/client/petstore/java/okhttp-gson-3.1/docs/FakeApi.md
+++ b/samples/client/petstore/java/okhttp-gson-3.1/docs/FakeApi.md
@@ -4,11 +4,72 @@ All URIs are relative to *http://petstore.swagger.io/v2*
| Method | HTTP request | Description |
|------------- | ------------- | -------------|
+| [**refToRefParameter**](FakeApi.md#refToRefParameter) | **GET** /ref/ref_to_parameter | |
| [**responseNoRef**](FakeApi.md#responseNoRef) | **GET** /no_ref | |
| [**responseRefToNoRef**](FakeApi.md#responseRefToNoRef) | **GET** /ref/no_ref | |
| [**responseRefToRef**](FakeApi.md#responseRefToRef) | **GET** /ref/ref | |
+
+# **refToRefParameter**
+> String refToRefParameter(refToUuid)
+
+
+
+### Example
+```java
+// Import classes:
+import org.openapitools.client.ApiClient;
+import org.openapitools.client.ApiException;
+import org.openapitools.client.Configuration;
+import org.openapitools.client.models.*;
+import org.openapitools.client.api.FakeApi;
+
+public class Example {
+ public static void main(String[] args) {
+ ApiClient defaultClient = Configuration.getDefaultApiClient();
+ defaultClient.setBasePath("http://petstore.swagger.io/v2");
+
+ FakeApi apiInstance = new FakeApi(defaultClient);
+ UUID refToUuid = UUID.fromString("61864654-6e6b-4152-a62f-795fdd606bc2"); // UUID | to test ref to parameter (uuid)
+ try {
+ String result = apiInstance.refToRefParameter(refToUuid);
+ System.out.println(result);
+ } catch (ApiException e) {
+ System.err.println("Exception when calling FakeApi#refToRefParameter");
+ System.err.println("Status code: " + e.getCode());
+ System.err.println("Reason: " + e.getResponseBody());
+ System.err.println("Response headers: " + e.getResponseHeaders());
+ e.printStackTrace();
+ }
+ }
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+|------------- | ------------- | ------------- | -------------|
+| **refToUuid** | **UUID**| to test ref to parameter (uuid) | |
+
+### Return type
+
+**String**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: text/plain
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **200** | | - |
+
# **responseNoRef**
> String responseNoRef()
diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/api/FakeApi.java
index d20d03caea5..c830be226b6 100644
--- a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/api/FakeApi.java
+++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/api/FakeApi.java
@@ -27,6 +27,7 @@ import com.google.gson.reflect.TypeToken;
import java.io.IOException;
+import java.util.UUID;
import java.lang.reflect.Type;
import java.util.ArrayList;
@@ -71,6 +72,132 @@ public class FakeApi {
this.localCustomBaseUrl = customBaseUrl;
}
+ /**
+ * Build call for refToRefParameter
+ * @param refToUuid to test ref to parameter (uuid) (required)
+ * @param _callback Callback for upload/download progress
+ * @return Call to execute
+ * @throws ApiException If fail to serialize the request body object
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | | - |
+
+ */
+ public okhttp3.Call refToRefParameterCall(UUID refToUuid, final ApiCallback _callback) throws ApiException {
+ String basePath = null;
+ // Operation Servers
+ String[] localBasePaths = new String[] { };
+
+ // Determine Base Path to Use
+ if (localCustomBaseUrl != null){
+ basePath = localCustomBaseUrl;
+ } else if ( localBasePaths.length > 0 ) {
+ basePath = localBasePaths[localHostIndex];
+ } else {
+ basePath = null;
+ }
+
+ Object localVarPostBody = null;
+
+ // create path and map variables
+ String localVarPath = "/ref/ref_to_parameter";
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ Map localVarHeaderParams = new HashMap();
+ Map localVarCookieParams = new HashMap();
+ Map localVarFormParams = new HashMap();
+
+ if (refToUuid != null) {
+ localVarHeaderParams.put("ref_to_uuid", localVarApiClient.parameterToString(refToUuid));
+ }
+
+ final String[] localVarAccepts = {
+ "text/plain"
+ };
+ final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) {
+ localVarHeaderParams.put("Accept", localVarAccept);
+ }
+
+ final String[] localVarContentTypes = {
+ };
+ final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
+ if (localVarContentType != null) {
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+ }
+
+ String[] localVarAuthNames = new String[] { };
+ return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
+ }
+
+ @SuppressWarnings("rawtypes")
+ private okhttp3.Call refToRefParameterValidateBeforeCall(UUID refToUuid, final ApiCallback _callback) throws ApiException {
+ // verify the required parameter 'refToUuid' is set
+ if (refToUuid == null) {
+ throw new ApiException("Missing the required parameter 'refToUuid' when calling refToRefParameter(Async)");
+ }
+
+ return refToRefParameterCall(refToUuid, _callback);
+
+ }
+
+ /**
+ *
+ *
+ * @param refToUuid to test ref to parameter (uuid) (required)
+ * @return String
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | | - |
+
+ */
+ public String refToRefParameter(UUID refToUuid) throws ApiException {
+ ApiResponse localVarResp = refToRefParameterWithHttpInfo(refToUuid);
+ return localVarResp.getData();
+ }
+
+ /**
+ *
+ *
+ * @param refToUuid to test ref to parameter (uuid) (required)
+ * @return ApiResponse<String>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | | - |
+
+ */
+ public ApiResponse refToRefParameterWithHttpInfo(UUID refToUuid) throws ApiException {
+ okhttp3.Call localVarCall = refToRefParameterValidateBeforeCall(refToUuid, null);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ return localVarApiClient.execute(localVarCall, localVarReturnType);
+ }
+
+ /**
+ * (asynchronously)
+ *
+ * @param refToUuid to test ref to parameter (uuid) (required)
+ * @param _callback The callback to be executed when the API call finishes
+ * @return The request call
+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | | - |
+
+ */
+ public okhttp3.Call refToRefParameterAsync(UUID refToUuid, final ApiCallback _callback) throws ApiException {
+
+ okhttp3.Call localVarCall = refToRefParameterValidateBeforeCall(refToUuid, _callback);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
+ return localVarCall;
+ }
/**
* Build call for responseNoRef
* @param _callback Callback for upload/download progress