From ae2ab108021de7552b7f923f77f9483b4880ea3c Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 28 May 2025 17:51:19 +0800 Subject: [PATCH 1/2] better handling of metadata in allof --- .../codegen/InlineModelResolver.java | 13 +--- .../codegen/OpenAPINormalizer.java | 48 +++++++++++++++ .../codegen/utils/ModelUtils.java | 61 ++++++++++++++++++- .../codegen/OpenAPINormalizerTest.java | 19 ++++++ .../3_0/allof_with_metadata_only_schemas.yaml | 47 ++++++++++++++ 5 files changed, 174 insertions(+), 14 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/allof_with_metadata_only_schemas.yaml diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java index 623ad634ae1f..aa32789d1b25 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java @@ -418,18 +418,7 @@ private void gatherInlineModels(Schema schema, String modelPrefix) { if (schema.getAllOf().size() == 1) { // handle earlier in this function when looping through properties } else if (schema.getAllOf().size() > 1) { - // Check if there is only one "non metadata" schema. - // For example, there may be an `description` only schema that is used to override the descrption. - // In these cases, we can simply discard those schemas. - List nonMetadataOnlySchemas = (List) schema.getAllOf().stream() - .filter(v -> ModelUtils.isMetadataOnlySchema((Schema) v)) - .collect(Collectors.toList()); - - if (nonMetadataOnlySchemas.size() == 1) { - schema.setAllOf(nonMetadataOnlySchemas); - } else { - LOGGER.warn("allOf schema `{}` containing multiple types (not model) is not supported at the moment.", schema.getName()); - } + LOGGER.warn("allOf schema `{}` containing multiple types (not model) is not supported at the moment.", schema.getName()); } else { LOGGER.error("allOf schema `{}` contains no items.", schema.getName()); } 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 eda548cef8a0..b8a09f99a0b5 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 @@ -851,6 +851,52 @@ protected void normalizeProperties(Map properties, Set v } } + protected void refactorAllOfWithMetadataOnlySchemas(Schema schema) { + if (schema.getAllOf() == null) { + return; + } + + // Check if there are metadata schemas. + // For example, there may be an `description` only schema that is used to override the descrption. + List nonMetadataOnlySchemas = new ArrayList<>(); + List metadataOnlySchemas = new ArrayList<>(); + + for (Object s: schema.getAllOf()) { + if (s instanceof Schema) { + if (ModelUtils.isMetadataOnlySchema((Schema) s)) { + metadataOnlySchemas.add((Schema) s); + } else { + nonMetadataOnlySchemas.add((Schema) s); + } + } + } + + // ReferenceNumber: + // allOf: + // - $ref: '#/components/schemas/IEAN8' + // - description: Product Ref + // - example: IEAN1234 + // + // becomes the following after the following code block + // + // ReferenceNumber: + // allOf: + // - $ref: '#/components/schemas/IEAN8' + // description: Product Ref + // example: IEAN1234 + // + // which can be further processed by the generator + if (nonMetadataOnlySchemas.size() > 0) { + // keep the non metadata schema(s) + schema.setAllOf(nonMetadataOnlySchemas); + + // copy metadata to the allOf schema + for (Schema metadataOnlySchema: metadataOnlySchemas) { + ModelUtils.copyMetadata(metadataOnlySchema, schema); + } + } + } + /* * Remove unsupported schemas (e.g. if, then) from allOf. * @@ -882,6 +928,8 @@ protected void removeUnsupportedSchemasFromAllOf(Schema schema) { protected Schema normalizeAllOf(Schema schema, Set visitedSchemas) { removeUnsupportedSchemasFromAllOf(schema); + refactorAllOfWithMetadataOnlySchemas(schema); + if (schema.getAllOf() == null) { return schema; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java index c499dec694c9..405934531f01 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java @@ -2353,6 +2353,63 @@ public static boolean isUnsupportedSchema(OpenAPI openAPI, Schema schema) { return false; } + /** + * Copy meta data (e.g. description, default, examples, etc) from one schema to another. + * + * @param from From schema + * @param to To schema + */ + public static void copyMetadata(Schema from, Schema to) { + if (from.getDescription() != null) { + to.setDescription(from.getDescription()); + } + if (from.getDefault() != null) { + to.setDefault(from.getDefault()); + } + if (from.getDeprecated() != null) { + to.setDeprecated(from.getDeprecated()); + } + if (from.getNullable() != null) { + to.setNullable(from.getNullable()); + } + if (from.getExample() != null) { + to.setExample(from.getExample()); + } + if (from.getExamples() != null) { + to.setExample(from.getExamples()); + } + if (from.getReadOnly() != null) { + to.setReadOnly(from.getReadOnly()); + } + if (from.getWriteOnly() != null) { + to.setWriteOnly(from.getWriteOnly()); + } + if (from.getExtensions() != null) { + to.setExtensions(from.getExtensions()); + } + if (from.getMaxLength() != null) { + to.setMaxLength(from.getMaxLength()); + } + if (from.getMinLength() != null) { + to.setMinLength(from.getMinLength()); + } + if (from.getMaxItems() != null) { + to.setMaxItems(from.getMaxItems()); + } + if (from.getMinItems() != null) { + to.setMinItems(from.getMinItems()); + } + if (from.getMaximum() != null) { + to.setMaximum(from.getMaximum()); + } + if (from.getMinimum() != null) { + to.setMinimum(from.getMinimum()); + } + if (from.getTitle() != null) { + to.setTitle(from.getTitle()); + } + } + /** * Returns true if a schema is only metadata and not an actual type. * For example, a schema that only has a `description` without any `properties` or `$ref` defined. @@ -2361,7 +2418,7 @@ public static boolean isUnsupportedSchema(OpenAPI openAPI, Schema schema) { * @return if the schema is only metadata and not an actual type */ public static boolean isMetadataOnlySchema(Schema schema) { - return schema.get$ref() != null || + return !(schema.get$ref() != null || schema.getProperties() != null || schema.getType() != null || schema.getAdditionalProperties() != null || @@ -2375,7 +2432,7 @@ public static boolean isMetadataOnlySchema(Schema schema) { schema.getContains() != null || schema.get$dynamicAnchor() != null || schema.get$anchor() != null || - schema.getContentSchema() != null; + schema.getContentSchema() != null); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/OpenAPINormalizerTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/OpenAPINormalizerTest.java index ca371c2c4051..1d41104f8dc0 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/OpenAPINormalizerTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/OpenAPINormalizerTest.java @@ -79,6 +79,25 @@ public void testOpenAPINormalizerRefAsParentInAllOfAndRefactorAllOfWithPropertie assertNull(schema4.getExtensions()); } + @Test + public void testOpenAPINormalizerRefactorAllofWithMetadataOnlySchemas() { + // to test the rule REF_AS_PARENT_IN_ALLOF + OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/allof_with_metadata_only_schemas.yaml"); + + Schema schema = openAPI.getComponents().getSchemas().get("ReferenceNumber"); + assertEquals(schema.getAllOf().size(), 3); + assertEquals(((Schema) schema.getAllOf().get(2)).getExample(), "IEAN1234"); + + Map options = new HashMap<>(); + OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options); + openAPINormalizer.normalize(); + + Schema schema2 = openAPI.getComponents().getSchemas().get("ReferenceNumber"); + assertEquals(schema2.getAllOf().size(), 1); + assertEquals(schema2.getExample(), "IEAN1234"); + assertEquals(((Schema) schema2.getAllOf().get(0)).get$ref(), "#/components/schemas/IEAN8"); + } + @Test public void testOpenAPINormalizerEnableKeepOnlyFirstTagInOperation() { OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/enableKeepOnlyFirstTagInOperation_test.yaml"); diff --git a/modules/openapi-generator/src/test/resources/3_0/allof_with_metadata_only_schemas.yaml b/modules/openapi-generator/src/test/resources/3_0/allof_with_metadata_only_schemas.yaml new file mode 100644 index 000000000000..c3b1ef6fb9ac --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/allof_with_metadata_only_schemas.yaml @@ -0,0 +1,47 @@ +openapi: 3.0.3 +info: + version: 1.0.0 + title: Test +paths: + /api/productRef: + get: + operationId: getProductRef + summary: Retrieve product reference + description: Returns a product reference based on a given product. + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ProductType' +components: + schemas: + ProductType: + type: object + required: + - referenceNumber + properties: + referenceNumber: + $ref: "#/components/schemas/ReferenceNumber" + ReferenceNumber: + allOf: + - $ref: "#/components/schemas/IEAN8" + - description: Product Ref + - example: IEAN1234 + IEAN8: + type: string + minLength: 8 + maxLength: 8 + example: "IEAN1234" + Order: + type: object + properties: + id: + type: integer + format: int64 + foo: + allOf: + - $ref: '#/components/schemas/ProductType' + - description: 'this is foo' + - example: 'this is bar' From c055d5b89679e12b93a61efad00349ac1b6fa691 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 28 May 2025 18:02:52 +0800 Subject: [PATCH 2/2] update samples --- .../rust/hyper/petstore/docs/TestAllOfWithMultiMetadataOnly.md | 2 +- .../src/models/test_all_of_with_multi_metadata_only.rs | 2 +- .../hyper0x/petstore/docs/TestAllOfWithMultiMetadataOnly.md | 2 +- .../src/models/test_all_of_with_multi_metadata_only.rs | 2 +- .../petstore/docs/TestAllOfWithMultiMetadataOnly.md | 2 +- .../src/models/test_all_of_with_multi_metadata_only.rs | 2 +- .../docs/TestAllOfWithMultiMetadataOnly.md | 2 +- .../src/models/test_all_of_with_multi_metadata_only.rs | 2 +- .../docs/TestAllOfWithMultiMetadataOnly.md | 2 +- .../src/models/test_all_of_with_multi_metadata_only.rs | 2 +- .../petstore-async/docs/TestAllOfWithMultiMetadataOnly.md | 2 +- .../src/models/test_all_of_with_multi_metadata_only.rs | 2 +- .../petstore-avoid-box/docs/TestAllOfWithMultiMetadataOnly.md | 2 +- .../src/models/test_all_of_with_multi_metadata_only.rs | 2 +- .../docs/TestAllOfWithMultiMetadataOnly.md | 2 +- .../src/models/test_all_of_with_multi_metadata_only.rs | 2 +- .../docs/FooTestAllOfWithMultiMetadataOnly.md | 2 +- .../src/models/foo_test_all_of_with_multi_metadata_only.rs | 2 +- .../reqwest/petstore/docs/TestAllOfWithMultiMetadataOnly.md | 2 +- .../src/models/test_all_of_with_multi_metadata_only.rs | 2 +- .../petstore/typescript-axios/builds/composed-schemas/api.ts | 2 +- .../typescript-axios/builds/composed-schemas/docs/Dog.md | 1 + .../petstore/typescript/builds/composed-schemas/models/Dog.ts | 3 +++ 23 files changed, 25 insertions(+), 21 deletions(-) diff --git a/samples/client/petstore/rust/hyper/petstore/docs/TestAllOfWithMultiMetadataOnly.md b/samples/client/petstore/rust/hyper/petstore/docs/TestAllOfWithMultiMetadataOnly.md index e460a9470534..dd00f5fe3f70 100644 --- a/samples/client/petstore/rust/hyper/petstore/docs/TestAllOfWithMultiMetadataOnly.md +++ b/samples/client/petstore/rust/hyper/petstore/docs/TestAllOfWithMultiMetadataOnly.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | Option<**i64**> | | [optional] -**foo** | Option<**Vec**> | existing_tags_array | [optional] +**foo** | Option<**Vec**> | This is a test for allOf with metadata only fields | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/test_all_of_with_multi_metadata_only.rs b/samples/client/petstore/rust/hyper/petstore/src/models/test_all_of_with_multi_metadata_only.rs index a19b2e1b2882..5d7ad9147d3f 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/test_all_of_with_multi_metadata_only.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/test_all_of_with_multi_metadata_only.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; pub struct TestAllOfWithMultiMetadataOnly { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - /// existing_tags_array + /// This is a test for allOf with metadata only fields #[serde(rename = "foo", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub foo: Option>>, } diff --git a/samples/client/petstore/rust/hyper0x/petstore/docs/TestAllOfWithMultiMetadataOnly.md b/samples/client/petstore/rust/hyper0x/petstore/docs/TestAllOfWithMultiMetadataOnly.md index e460a9470534..dd00f5fe3f70 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/docs/TestAllOfWithMultiMetadataOnly.md +++ b/samples/client/petstore/rust/hyper0x/petstore/docs/TestAllOfWithMultiMetadataOnly.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | Option<**i64**> | | [optional] -**foo** | Option<**Vec**> | existing_tags_array | [optional] +**foo** | Option<**Vec**> | This is a test for allOf with metadata only fields | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/hyper0x/petstore/src/models/test_all_of_with_multi_metadata_only.rs b/samples/client/petstore/rust/hyper0x/petstore/src/models/test_all_of_with_multi_metadata_only.rs index a19b2e1b2882..5d7ad9147d3f 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/src/models/test_all_of_with_multi_metadata_only.rs +++ b/samples/client/petstore/rust/hyper0x/petstore/src/models/test_all_of_with_multi_metadata_only.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; pub struct TestAllOfWithMultiMetadataOnly { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - /// existing_tags_array + /// This is a test for allOf with metadata only fields #[serde(rename = "foo", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub foo: Option>>, } diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/docs/TestAllOfWithMultiMetadataOnly.md b/samples/client/petstore/rust/reqwest-trait/petstore/docs/TestAllOfWithMultiMetadataOnly.md index e460a9470534..dd00f5fe3f70 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/docs/TestAllOfWithMultiMetadataOnly.md +++ b/samples/client/petstore/rust/reqwest-trait/petstore/docs/TestAllOfWithMultiMetadataOnly.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | Option<**i64**> | | [optional] -**foo** | Option<**Vec**> | existing_tags_array | [optional] +**foo** | Option<**Vec**> | This is a test for allOf with metadata only fields | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/src/models/test_all_of_with_multi_metadata_only.rs b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/test_all_of_with_multi_metadata_only.rs index a19b2e1b2882..5d7ad9147d3f 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/src/models/test_all_of_with_multi_metadata_only.rs +++ b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/test_all_of_with_multi_metadata_only.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; pub struct TestAllOfWithMultiMetadataOnly { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - /// existing_tags_array + /// This is a test for allOf with metadata only fields #[serde(rename = "foo", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub foo: Option>>, } diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/TestAllOfWithMultiMetadataOnly.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/TestAllOfWithMultiMetadataOnly.md index e460a9470534..dd00f5fe3f70 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/TestAllOfWithMultiMetadataOnly.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/TestAllOfWithMultiMetadataOnly.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | Option<**i64**> | | [optional] -**foo** | Option<**Vec**> | existing_tags_array | [optional] +**foo** | Option<**Vec**> | This is a test for allOf with metadata only fields | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/test_all_of_with_multi_metadata_only.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/test_all_of_with_multi_metadata_only.rs index a19b2e1b2882..5d7ad9147d3f 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/test_all_of_with_multi_metadata_only.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/test_all_of_with_multi_metadata_only.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; pub struct TestAllOfWithMultiMetadataOnly { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - /// existing_tags_array + /// This is a test for allOf with metadata only fields #[serde(rename = "foo", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub foo: Option>>, } diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/TestAllOfWithMultiMetadataOnly.md b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/TestAllOfWithMultiMetadataOnly.md index e460a9470534..dd00f5fe3f70 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/TestAllOfWithMultiMetadataOnly.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/TestAllOfWithMultiMetadataOnly.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | Option<**i64**> | | [optional] -**foo** | Option<**Vec**> | existing_tags_array | [optional] +**foo** | Option<**Vec**> | This is a test for allOf with metadata only fields | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/test_all_of_with_multi_metadata_only.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/test_all_of_with_multi_metadata_only.rs index a19b2e1b2882..5d7ad9147d3f 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/test_all_of_with_multi_metadata_only.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/test_all_of_with_multi_metadata_only.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; pub struct TestAllOfWithMultiMetadataOnly { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - /// existing_tags_array + /// This is a test for allOf with metadata only fields #[serde(rename = "foo", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub foo: Option>>, } diff --git a/samples/client/petstore/rust/reqwest/petstore-async/docs/TestAllOfWithMultiMetadataOnly.md b/samples/client/petstore/rust/reqwest/petstore-async/docs/TestAllOfWithMultiMetadataOnly.md index e460a9470534..dd00f5fe3f70 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/docs/TestAllOfWithMultiMetadataOnly.md +++ b/samples/client/petstore/rust/reqwest/petstore-async/docs/TestAllOfWithMultiMetadataOnly.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | Option<**i64**> | | [optional] -**foo** | Option<**Vec**> | existing_tags_array | [optional] +**foo** | Option<**Vec**> | This is a test for allOf with metadata only fields | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/test_all_of_with_multi_metadata_only.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/test_all_of_with_multi_metadata_only.rs index a19b2e1b2882..5d7ad9147d3f 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/test_all_of_with_multi_metadata_only.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/test_all_of_with_multi_metadata_only.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; pub struct TestAllOfWithMultiMetadataOnly { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - /// existing_tags_array + /// This is a test for allOf with metadata only fields #[serde(rename = "foo", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub foo: Option>>, } diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/TestAllOfWithMultiMetadataOnly.md b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/TestAllOfWithMultiMetadataOnly.md index e460a9470534..dd00f5fe3f70 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/TestAllOfWithMultiMetadataOnly.md +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/TestAllOfWithMultiMetadataOnly.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | Option<**i64**> | | [optional] -**foo** | Option<**Vec**> | existing_tags_array | [optional] +**foo** | Option<**Vec**> | This is a test for allOf with metadata only fields | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/test_all_of_with_multi_metadata_only.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/test_all_of_with_multi_metadata_only.rs index a19b2e1b2882..5d7ad9147d3f 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/test_all_of_with_multi_metadata_only.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/test_all_of_with_multi_metadata_only.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; pub struct TestAllOfWithMultiMetadataOnly { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - /// existing_tags_array + /// This is a test for allOf with metadata only fields #[serde(rename = "foo", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub foo: Option>>, } diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/TestAllOfWithMultiMetadataOnly.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/TestAllOfWithMultiMetadataOnly.md index e460a9470534..dd00f5fe3f70 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/TestAllOfWithMultiMetadataOnly.md +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/TestAllOfWithMultiMetadataOnly.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | Option<**i64**> | | [optional] -**foo** | Option<**Vec**> | existing_tags_array | [optional] +**foo** | Option<**Vec**> | This is a test for allOf with metadata only fields | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/test_all_of_with_multi_metadata_only.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/test_all_of_with_multi_metadata_only.rs index a19b2e1b2882..5d7ad9147d3f 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/test_all_of_with_multi_metadata_only.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/test_all_of_with_multi_metadata_only.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; pub struct TestAllOfWithMultiMetadataOnly { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - /// existing_tags_array + /// This is a test for allOf with metadata only fields #[serde(rename = "foo", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub foo: Option>>, } diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooTestAllOfWithMultiMetadataOnly.md b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooTestAllOfWithMultiMetadataOnly.md index ea6c80aab59f..a2040960588e 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooTestAllOfWithMultiMetadataOnly.md +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooTestAllOfWithMultiMetadataOnly.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | Option<**i64**> | | [optional] -**foo** | Option<**Vec**> | existing_tags_array | [optional] +**foo** | Option<**Vec**> | This is a test for allOf with metadata only fields | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_test_all_of_with_multi_metadata_only.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_test_all_of_with_multi_metadata_only.rs index 50ea98b4954b..e28accb23678 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_test_all_of_with_multi_metadata_only.rs +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_test_all_of_with_multi_metadata_only.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; pub struct FooTestAllOfWithMultiMetadataOnly { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - /// existing_tags_array + /// This is a test for allOf with metadata only fields #[serde(rename = "foo", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub foo: Option>>, } diff --git a/samples/client/petstore/rust/reqwest/petstore/docs/TestAllOfWithMultiMetadataOnly.md b/samples/client/petstore/rust/reqwest/petstore/docs/TestAllOfWithMultiMetadataOnly.md index e460a9470534..dd00f5fe3f70 100644 --- a/samples/client/petstore/rust/reqwest/petstore/docs/TestAllOfWithMultiMetadataOnly.md +++ b/samples/client/petstore/rust/reqwest/petstore/docs/TestAllOfWithMultiMetadataOnly.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | Option<**i64**> | | [optional] -**foo** | Option<**Vec**> | existing_tags_array | [optional] +**foo** | Option<**Vec**> | This is a test for allOf with metadata only fields | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/test_all_of_with_multi_metadata_only.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/test_all_of_with_multi_metadata_only.rs index a19b2e1b2882..5d7ad9147d3f 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/test_all_of_with_multi_metadata_only.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/test_all_of_with_multi_metadata_only.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; pub struct TestAllOfWithMultiMetadataOnly { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - /// existing_tags_array + /// This is a test for allOf with metadata only fields #[serde(rename = "foo", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub foo: Option>>, } diff --git a/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts b/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts index ec700d2cbdd2..0d660bab09db 100644 --- a/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts +++ b/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts @@ -43,7 +43,7 @@ export interface Cat { 'age'?: number; } /** - * + * Dog information * @export * @interface Dog */ diff --git a/samples/client/petstore/typescript-axios/builds/composed-schemas/docs/Dog.md b/samples/client/petstore/typescript-axios/builds/composed-schemas/docs/Dog.md index cb152d6ab4be..4ffa19b02bdb 100644 --- a/samples/client/petstore/typescript-axios/builds/composed-schemas/docs/Dog.md +++ b/samples/client/petstore/typescript-axios/builds/composed-schemas/docs/Dog.md @@ -1,5 +1,6 @@ # Dog +Dog information ## Properties diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Dog.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Dog.ts index 5a3e5f0fa481..8fc32b4bc122 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Dog.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Dog.ts @@ -12,6 +12,9 @@ import { HttpFile } from '../http/http'; +/** +* Dog information +*/ export class Dog { 'bark'?: boolean; 'breed'?: DogBreedEnum;