diff --git a/samples/client/petstore/dart2/openapi/.openapi-generator/VERSION b/samples/client/petstore/dart2/openapi/.openapi-generator/VERSION index 71d2eb1c7fcd..d99e7162d01f 100644 --- a/samples/client/petstore/dart2/openapi/.openapi-generator/VERSION +++ b/samples/client/petstore/dart2/openapi/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT +5.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart2/openapi/lib/api/pet_api.dart b/samples/client/petstore/dart2/openapi/lib/api/pet_api.dart index 2b00c7d63b73..a413df7b4242 100644 --- a/samples/client/petstore/dart2/openapi/lib/api/pet_api.dart +++ b/samples/client/petstore/dart2/openapi/lib/api/pet_api.dart @@ -28,10 +28,10 @@ class PetApi { List contentTypes = ["application/json","application/xml"]; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -46,7 +46,7 @@ class PetApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -86,10 +86,10 @@ class PetApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -104,7 +104,7 @@ class PetApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -144,10 +144,10 @@ class PetApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -162,7 +162,7 @@ class PetApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -203,10 +203,10 @@ class PetApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -221,7 +221,7 @@ class PetApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -261,10 +261,10 @@ class PetApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = ["api_key"]; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -279,7 +279,7 @@ class PetApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -319,10 +319,10 @@ class PetApi { List contentTypes = ["application/json","application/xml"]; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -337,7 +337,7 @@ class PetApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -376,10 +376,10 @@ class PetApi { List contentTypes = ["application/x-www-form-urlencoded"]; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if (name != null) { @@ -406,7 +406,7 @@ class PetApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -445,10 +445,10 @@ class PetApi { List contentTypes = ["multipart/form-data"]; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if (additionalMetadata != null) { @@ -474,7 +474,7 @@ class PetApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } diff --git a/samples/client/petstore/dart2/openapi/lib/api/store_api.dart b/samples/client/petstore/dart2/openapi/lib/api/store_api.dart index 3b48cbbc4a3b..10dc4a35b85a 100644 --- a/samples/client/petstore/dart2/openapi/lib/api/store_api.dart +++ b/samples/client/petstore/dart2/openapi/lib/api/store_api.dart @@ -28,10 +28,10 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -46,7 +46,7 @@ class StoreApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -82,10 +82,10 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = ["api_key"]; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -100,7 +100,7 @@ class StoreApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -141,10 +141,10 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -159,7 +159,7 @@ class StoreApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -199,10 +199,10 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -217,7 +217,7 @@ class StoreApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } diff --git a/samples/client/petstore/dart2/openapi/lib/api/user_api.dart b/samples/client/petstore/dart2/openapi/lib/api/user_api.dart index 5a35ba394c08..a940ca410713 100644 --- a/samples/client/petstore/dart2/openapi/lib/api/user_api.dart +++ b/samples/client/petstore/dart2/openapi/lib/api/user_api.dart @@ -28,10 +28,10 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -46,7 +46,7 @@ class UserApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -85,10 +85,10 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -103,7 +103,7 @@ class UserApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -142,10 +142,10 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -160,7 +160,7 @@ class UserApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -199,10 +199,10 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -217,7 +217,7 @@ class UserApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -256,10 +256,10 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -274,7 +274,7 @@ class UserApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -319,10 +319,10 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -337,7 +337,7 @@ class UserApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -374,10 +374,10 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -392,7 +392,7 @@ class UserApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } @@ -434,10 +434,10 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; + String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = MultipartRequest(null, null); if(hasFields) @@ -452,7 +452,7 @@ class UserApi { postBody, headerParams, formParams, - contentType, + nullableContentType, authNames); return response; } diff --git a/samples/client/petstore/dart2/openapi/lib/api_client.dart b/samples/client/petstore/dart2/openapi/lib/api_client.dart index 793ac6a73410..d68c9691879f 100644 --- a/samples/client/petstore/dart2/openapi/lib/api_client.dart +++ b/samples/client/petstore/dart2/openapi/lib/api_client.dart @@ -100,7 +100,7 @@ class ApiClient { Object body, Map headerParams, Map formParams, - String contentType, + String nullableContentType, List authNames) async { _updateParamsForAuth(authNames, queryParams, headerParams); @@ -116,7 +116,10 @@ class ApiClient { String url = basePath + path + queryString; headerParams.addAll(_defaultHeaderMap); - headerParams['Content-Type'] = contentType; + if (nullableContentType != null) { + final contentType = nullableContentType; + headerParams['Content-Type'] = contentType; + } if(body is MultipartRequest) { var request = MultipartRequest(method, Uri.parse(url)); @@ -127,20 +130,21 @@ class ApiClient { var response = await client.send(request); return Response.fromStream(response); } else { - var msgBody = contentType == "application/x-www-form-urlencoded" ? formParams : serialize(body); + var msgBody = nullableContentType == "application/x-www-form-urlencoded" ? formParams : serialize(body); + final nullableHeaderParams = (headerParams.isEmpty)? null: headerParams; switch(method) { case "POST": - return client.post(url, headers: headerParams, body: msgBody); + return client.post(url, headers: nullableHeaderParams, body: msgBody); case "PUT": - return client.put(url, headers: headerParams, body: msgBody); + return client.put(url, headers: nullableHeaderParams, body: msgBody); case "DELETE": - return client.delete(url, headers: headerParams); + return client.delete(url, headers: nullableHeaderParams); case "PATCH": - return client.patch(url, headers: headerParams, body: msgBody); + return client.patch(url, headers: nullableHeaderParams, body: msgBody); case "HEAD": - return client.head(url, headers: headerParams); + return client.head(url, headers: nullableHeaderParams); default: - return client.get(url, headers: headerParams); + return client.get(url, headers: nullableHeaderParams); } } } diff --git a/samples/server/petstore/jaxrs-jersey/README.md b/samples/server/petstore/jaxrs-jersey/README.md index 64a6c60dc38e..4d4b9499d449 100644 --- a/samples/server/petstore/jaxrs-jersey/README.md +++ b/samples/server/petstore/jaxrs-jersey/README.md @@ -17,7 +17,7 @@ mvn clean package jetty:run You can then view the OpenAPI v2 specification here: ``` -http://localhost:8080/v2/swagger.json +http://localhost:80/v2/swagger.json ``` Note that if you have configured the `host` to be something other than localhost, the calls through diff --git a/samples/server/petstore/jaxrs-jersey/pom.xml b/samples/server/petstore/jaxrs-jersey/pom.xml index ecfcfd15f7ad..a60e297f03f4 100644 --- a/samples/server/petstore/jaxrs-jersey/pom.xml +++ b/samples/server/petstore/jaxrs-jersey/pom.xml @@ -47,7 +47,7 @@ stopit 10 - 8080 + 80 60000 diff --git a/samples/server/petstore/php-slim4/lib/Model/EnumClass.php b/samples/server/petstore/php-slim4/lib/Model/EnumClass.php index c3998d8602c5..3ddd829b3137 100644 --- a/samples/server/petstore/php-slim4/lib/Model/EnumClass.php +++ b/samples/server/petstore/php-slim4/lib/Model/EnumClass.php @@ -30,8 +30,8 @@ class EnumClass implements ModelInterface private const MODEL_SCHEMA = <<<'SCHEMA' { "type" : "string", - "enum" : [ "_abc", "-efg", "(xyz)" ], - "default" : "-efg" + "default" : "-efg", + "enum" : [ "_abc", "-efg", "(xyz)" ] } SCHEMA; diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs index 2b48730d92ae..7ed0cb95aacf 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs @@ -140,6 +140,15 @@ where // CallbackCallbackWithHeaderPost - POST /{$request.query.url}/callback-with-header &hyper::Method::POST if path.matched(paths::ID_REQUEST_QUERY_URL_CALLBACK_WITH_HEADER) => { + // Path parameters + let path: &str = &uri.path().to_string(); + let path_params = + paths::REGEX_REQUEST_QUERY_URL_CALLBACK_WITH_HEADER + .captures(&path) + .unwrap_or_else(|| + panic!("Path {} matched RE REQUEST_QUERY_URL_CALLBACK_WITH_HEADER in set but failed match against \"{}\"", path, paths::REGEX_REQUEST_QUERY_URL_CALLBACK_WITH_HEADER.as_str()) + ); + let callback_request_query_url = path_params["request_query_url"].to_string(); // Header parameters let param_information = headers.get(HeaderName::from_static("information")); @@ -199,6 +208,15 @@ where // CallbackCallbackPost - POST /{$request.query.url}/callback &hyper::Method::POST if path.matched(paths::ID_REQUEST_QUERY_URL_CALLBACK) => { + // Path parameters + let path: &str = &uri.path().to_string(); + let path_params = + paths::REGEX_REQUEST_QUERY_URL_CALLBACK + .captures(&path) + .unwrap_or_else(|| + panic!("Path {} matched RE REQUEST_QUERY_URL_CALLBACK in set but failed match against \"{}\"", path, paths::REGEX_REQUEST_QUERY_URL_CALLBACK.as_str()) + ); + let callback_request_query_url = path_params["request_query_url"].to_string(); Box::new({ {{