mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 22:20:56 +00:00
support nullable check for OAS 3.1 (#15698)
This commit is contained in:
parent
d2446013d1
commit
bc7bdca87f
@ -669,7 +669,35 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
|
||||
/**
|
||||
* If the schema is oneOf and the sub-schemas is null, set `nullable: true` instead.
|
||||
* Check if the schema is of type 'null'
|
||||
*
|
||||
* Return true if the schema's type is 'null' or not specified
|
||||
*
|
||||
* @param schema Schema
|
||||
*/
|
||||
private boolean isNullTypeSchema(Schema schema) {
|
||||
if (schema == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((schema.getType() == null || schema.getType().equals("null")) && schema.get$ref() == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// convert referenced enum of null only to `nullable:true`
|
||||
Schema referencedSchema = ModelUtils.getReferencedSchema(openAPI, schema);
|
||||
if (referencedSchema.getEnum() != null && referencedSchema.getEnum().size() == 1) {
|
||||
if ("null".equals(String.valueOf(referencedSchema.getEnum().get(0)))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the schema is oneOf and the sub-schemas is null, set `nullable: true`
|
||||
* instead.
|
||||
* If there's only one sub-schema, simply return the sub-schema directly.
|
||||
*
|
||||
* @param schema Schema
|
||||
@ -680,35 +708,19 @@ public class OpenAPINormalizer {
|
||||
return schema;
|
||||
}
|
||||
|
||||
if (schema.getOneOf() != null && !schema.getOneOf().isEmpty()) {
|
||||
for (int i = 0; i < schema.getOneOf().size(); i++) {
|
||||
// convert null sub-schema to `nullable: true`
|
||||
if (schema.getOneOf().get(i) == null ||
|
||||
(((Schema) schema.getOneOf().get(i)).getType() == null &&
|
||||
((Schema) schema.getOneOf().get(i)).get$ref() == null)) {
|
||||
schema.getOneOf().remove(i);
|
||||
schema.setNullable(true);
|
||||
continue;
|
||||
}
|
||||
List<Schema> oneOfSchemas = schema.getOneOf();
|
||||
if (oneOfSchemas != null) {
|
||||
if (oneOfSchemas.removeIf(oneOf -> isNullTypeSchema(oneOf))) {
|
||||
schema.setNullable(true);
|
||||
|
||||
// convert enum of null only to `nullable:true`
|
||||
Schema oneOfElement = ModelUtils.getReferencedSchema(openAPI, (Schema) schema.getOneOf().get(i));
|
||||
if (oneOfElement.getEnum() != null && oneOfElement.getEnum().size() == 1) {
|
||||
if ("null".equals(String.valueOf(oneOfElement.getEnum().get(0)))) {
|
||||
schema.setNullable(true);
|
||||
schema.getOneOf().remove(i);
|
||||
continue;
|
||||
// if only one element left, simplify to just the element (schema)
|
||||
if (oneOfSchemas.size() == 1) {
|
||||
if (Boolean.TRUE.equals(schema.getNullable())) { // retain nullable setting
|
||||
((Schema) oneOfSchemas.get(0)).setNullable(true);
|
||||
}
|
||||
return (Schema) oneOfSchemas.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
// if only one element left, simplify to just the element (schema)
|
||||
if (schema.getOneOf().size() == 1) {
|
||||
if (Boolean.TRUE.equals(schema.getNullable())) { // retain nullable setting
|
||||
((Schema) schema.getOneOf().get(0)).setNullable(true);
|
||||
}
|
||||
return (Schema) schema.getOneOf().get(0);
|
||||
}
|
||||
}
|
||||
|
||||
return schema;
|
||||
@ -726,34 +738,18 @@ public class OpenAPINormalizer {
|
||||
return schema;
|
||||
}
|
||||
|
||||
if (schema.getAnyOf() != null && !schema.getAnyOf().isEmpty()) {
|
||||
for (int i = 0; i < schema.getAnyOf().size(); i++) {
|
||||
// convert null sub-schema to `nullable: true`
|
||||
if (schema.getAnyOf().get(i) == null ||
|
||||
(((Schema) schema.getAnyOf().get(i)).getType() == null &&
|
||||
((Schema) schema.getAnyOf().get(i)).get$ref() == null)) {
|
||||
schema.getAnyOf().remove(i);
|
||||
schema.setNullable(true);
|
||||
continue;
|
||||
}
|
||||
|
||||
// convert enum of null only to `nullable:true`
|
||||
Schema anyOfElement = ModelUtils.getReferencedSchema(openAPI, (Schema) schema.getAnyOf().get(i));
|
||||
if (anyOfElement.getEnum() != null && anyOfElement.getEnum().size() == 1) {
|
||||
if ("null".equals(String.valueOf(anyOfElement.getEnum().get(0)))) {
|
||||
schema.setNullable(true);
|
||||
schema.getAnyOf().remove(i);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
List<Schema> anyOfSchemas = schema.getAnyOf();
|
||||
if (anyOfSchemas != null) {
|
||||
if (anyOfSchemas.removeIf(anyOf -> isNullTypeSchema(anyOf))) {
|
||||
schema.setNullable(true);
|
||||
}
|
||||
|
||||
// if only one element left, simplify to just the element (schema)
|
||||
if (schema.getAnyOf().size() == 1) {
|
||||
if (anyOfSchemas.size() == 1) {
|
||||
if (Boolean.TRUE.equals(schema.getNullable())) { // retain nullable setting
|
||||
((Schema) schema.getAnyOf().get(0)).setNullable(true);
|
||||
((Schema) anyOfSchemas.get(0)).setNullable(true);
|
||||
}
|
||||
return (Schema) schema.getAnyOf().get(0);
|
||||
return (Schema) anyOfSchemas.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,11 +141,11 @@ public class OpenAPINormalizerTest {
|
||||
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/simplifyOneOfAnyOf_test.yaml");
|
||||
|
||||
Schema schema = openAPI.getComponents().getSchemas().get("AnyOfTest");
|
||||
assertEquals(schema.getAnyOf().size(), 2);
|
||||
assertEquals(schema.getAnyOf().size(), 4);
|
||||
assertNull(schema.getNullable());
|
||||
|
||||
Schema schema2 = openAPI.getComponents().getSchemas().get("OneOfTest");
|
||||
assertEquals(schema2.getOneOf().size(), 2);
|
||||
assertEquals(schema2.getOneOf().size(), 4);
|
||||
assertNull(schema2.getNullable());
|
||||
|
||||
Schema schema5 = openAPI.getComponents().getSchemas().get("OneOfNullableTest");
|
||||
@ -168,6 +168,7 @@ public class OpenAPINormalizerTest {
|
||||
Schema schema4 = openAPI.getComponents().getSchemas().get("OneOfTest");
|
||||
assertNull(schema4.getOneOf());
|
||||
assertTrue(schema4 instanceof IntegerSchema);
|
||||
assertTrue(schema4.getNullable());
|
||||
|
||||
Schema schema6 = openAPI.getComponents().getSchemas().get("OneOfNullableTest");
|
||||
assertEquals(schema6.getOneOf().size(), 2);
|
||||
@ -273,7 +274,7 @@ public class OpenAPINormalizerTest {
|
||||
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/convertEnumNullToNullable_test.yaml");
|
||||
|
||||
Schema schema = openAPI.getComponents().getSchemas().get("AnyOfTest");
|
||||
assertEquals(schema.getAnyOf().size(), 3);
|
||||
assertEquals(schema.getAnyOf().size(), 4);
|
||||
assertNull(schema.getNullable());
|
||||
|
||||
Map<String, String> options = new HashMap<>();
|
||||
@ -292,7 +293,7 @@ public class OpenAPINormalizerTest {
|
||||
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/convertEnumNullToNullable_test.yaml");
|
||||
|
||||
Schema schema = openAPI.getComponents().getSchemas().get("AnyOfTest");
|
||||
assertEquals(schema.getAnyOf().size(), 3);
|
||||
assertEquals(schema.getAnyOf().size(), 4);
|
||||
assertNull(schema.getNullable());
|
||||
|
||||
Map<String, String> options = new HashMap<>();
|
||||
@ -313,7 +314,7 @@ public class OpenAPINormalizerTest {
|
||||
|
||||
// before test
|
||||
Schema schema = openAPI.getComponents().getSchemas().get("AnyOfTest");
|
||||
assertEquals(schema.getAnyOf().size(), 3);
|
||||
assertEquals(schema.getAnyOf().size(), 4);
|
||||
assertNull(schema.getNullable());
|
||||
|
||||
Map<String, String> options = new HashMap<>();
|
||||
@ -323,7 +324,7 @@ public class OpenAPINormalizerTest {
|
||||
|
||||
// checks should be the same after test
|
||||
Schema schema3 = openAPI.getComponents().getSchemas().get("AnyOfTest");
|
||||
assertEquals(schema3.getAnyOf().size(), 3);
|
||||
assertEquals(schema3.getAnyOf().size(), 4);
|
||||
assertNull(schema3.getNullable());
|
||||
}
|
||||
|
||||
|
@ -31,12 +31,17 @@ components:
|
||||
anyOf:
|
||||
- type: string
|
||||
- $ref: '#/components/schemas/EnumString'
|
||||
- $ref: '#/components/schemas/EnumNullString'
|
||||
- $ref: '#/components/schemas/EnumNull'
|
||||
EnumString:
|
||||
type: string
|
||||
enum:
|
||||
- A
|
||||
- B
|
||||
EnumNullString:
|
||||
type: string
|
||||
enum:
|
||||
- 'null'
|
||||
EnumNull:
|
||||
type: string
|
||||
enum:
|
||||
|
@ -30,11 +30,15 @@ components:
|
||||
description: to test anyOf
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
- type: null
|
||||
- $ref: null
|
||||
OneOfTest:
|
||||
description: to test oneOf
|
||||
oneOf:
|
||||
- type: integer
|
||||
- type: 'null'
|
||||
- type: null
|
||||
- $ref: null
|
||||
OneOfNullableTest:
|
||||
description: to test oneOf nullable
|
||||
|
@ -1971,8 +1971,8 @@ components:
|
||||
type: string
|
||||
fruitReq:
|
||||
additionalProperties: false
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/appleReq'
|
||||
- $ref: '#/components/schemas/bananaReq'
|
||||
appleReq:
|
||||
@ -2021,8 +2021,8 @@ components:
|
||||
in OAS schema >= 3.1.
|
||||
discriminator:
|
||||
propertyName: shapeType
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/Triangle'
|
||||
- $ref: '#/components/schemas/Quadrilateral'
|
||||
NullableShape:
|
||||
|
@ -90,7 +90,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeOrNull
|
||||
/// </summary>
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = false)]
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = true)]
|
||||
public ShapeOrNull ShapeOrNull
|
||||
{
|
||||
get{ return _ShapeOrNull;}
|
||||
|
@ -1971,8 +1971,8 @@ components:
|
||||
type: string
|
||||
fruitReq:
|
||||
additionalProperties: false
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/appleReq'
|
||||
- $ref: '#/components/schemas/bananaReq'
|
||||
appleReq:
|
||||
@ -2021,8 +2021,8 @@ components:
|
||||
in OAS schema >= 3.1.
|
||||
discriminator:
|
||||
propertyName: shapeType
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/Triangle'
|
||||
- $ref: '#/components/schemas/Quadrilateral'
|
||||
NullableShape:
|
||||
|
@ -5,9 +5,9 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**MainShape** | [**Shape**](Shape.md) | | [optional]
|
||||
**ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional]
|
||||
**Shapes** | [**List<Shape>**](Shape.md) | | [optional]
|
||||
**NullableShape** | [**NullableShape**](NullableShape.md) | | [optional]
|
||||
**ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [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)
|
||||
|
||||
|
@ -34,16 +34,16 @@ namespace Org.OpenAPITools.Model
|
||||
/// Initializes a new instance of the <see cref="Drawing" /> class.
|
||||
/// </summary>
|
||||
/// <param name="mainShape">mainShape</param>
|
||||
/// <param name="shapeOrNull">shapeOrNull</param>
|
||||
/// <param name="shapes">shapes</param>
|
||||
/// <param name="nullableShape">nullableShape</param>
|
||||
/// <param name="shapeOrNull">shapeOrNull</param>
|
||||
[JsonConstructor]
|
||||
public Drawing(Shape mainShape, ShapeOrNull shapeOrNull, List<Shape> shapes, NullableShape? nullableShape = default) : base()
|
||||
public Drawing(Shape mainShape, List<Shape> shapes, NullableShape? nullableShape = default, ShapeOrNull? shapeOrNull = default) : base()
|
||||
{
|
||||
MainShape = mainShape;
|
||||
ShapeOrNull = shapeOrNull;
|
||||
Shapes = shapes;
|
||||
NullableShape = nullableShape;
|
||||
ShapeOrNull = shapeOrNull;
|
||||
OnCreated();
|
||||
}
|
||||
|
||||
@ -55,12 +55,6 @@ namespace Org.OpenAPITools.Model
|
||||
[JsonPropertyName("mainShape")]
|
||||
public Shape MainShape { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeOrNull
|
||||
/// </summary>
|
||||
[JsonPropertyName("shapeOrNull")]
|
||||
public ShapeOrNull ShapeOrNull { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Shapes
|
||||
/// </summary>
|
||||
@ -73,6 +67,12 @@ namespace Org.OpenAPITools.Model
|
||||
[JsonPropertyName("nullableShape")]
|
||||
public NullableShape? NullableShape { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeOrNull
|
||||
/// </summary>
|
||||
[JsonPropertyName("shapeOrNull")]
|
||||
public ShapeOrNull? ShapeOrNull { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -83,9 +83,9 @@ namespace Org.OpenAPITools.Model
|
||||
sb.Append("class Drawing {\n");
|
||||
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
|
||||
sb.Append(" MainShape: ").Append(MainShape).Append("\n");
|
||||
sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append("\n");
|
||||
sb.Append(" Shapes: ").Append(Shapes).Append("\n");
|
||||
sb.Append(" NullableShape: ").Append(NullableShape).Append("\n");
|
||||
sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -124,9 +124,9 @@ namespace Org.OpenAPITools.Model
|
||||
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||
|
||||
Shape? mainShape = default;
|
||||
ShapeOrNull? shapeOrNull = default;
|
||||
List<Shape>? shapes = default;
|
||||
NullableShape? nullableShape = default;
|
||||
ShapeOrNull? shapeOrNull = default;
|
||||
|
||||
while (utf8JsonReader.Read())
|
||||
{
|
||||
@ -147,10 +147,6 @@ namespace Org.OpenAPITools.Model
|
||||
if (utf8JsonReader.TokenType != JsonTokenType.Null)
|
||||
mainShape = JsonSerializer.Deserialize<Shape>(ref utf8JsonReader, jsonSerializerOptions);
|
||||
break;
|
||||
case "shapeOrNull":
|
||||
if (utf8JsonReader.TokenType != JsonTokenType.Null)
|
||||
shapeOrNull = JsonSerializer.Deserialize<ShapeOrNull>(ref utf8JsonReader, jsonSerializerOptions);
|
||||
break;
|
||||
case "shapes":
|
||||
if (utf8JsonReader.TokenType != JsonTokenType.Null)
|
||||
shapes = JsonSerializer.Deserialize<List<Shape>>(ref utf8JsonReader, jsonSerializerOptions);
|
||||
@ -159,6 +155,10 @@ namespace Org.OpenAPITools.Model
|
||||
if (utf8JsonReader.TokenType != JsonTokenType.Null)
|
||||
nullableShape = JsonSerializer.Deserialize<NullableShape>(ref utf8JsonReader, jsonSerializerOptions);
|
||||
break;
|
||||
case "shapeOrNull":
|
||||
if (utf8JsonReader.TokenType != JsonTokenType.Null)
|
||||
shapeOrNull = JsonSerializer.Deserialize<ShapeOrNull>(ref utf8JsonReader, jsonSerializerOptions);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -168,13 +168,10 @@ namespace Org.OpenAPITools.Model
|
||||
if (mainShape == null)
|
||||
throw new ArgumentNullException(nameof(mainShape), "Property is required for class Drawing.");
|
||||
|
||||
if (shapeOrNull == null)
|
||||
throw new ArgumentNullException(nameof(shapeOrNull), "Property is required for class Drawing.");
|
||||
|
||||
if (shapes == null)
|
||||
throw new ArgumentNullException(nameof(shapes), "Property is required for class Drawing.");
|
||||
|
||||
return new Drawing(mainShape, shapeOrNull, shapes, nullableShape);
|
||||
return new Drawing(mainShape, shapes, nullableShape, shapeOrNull);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -190,12 +187,12 @@ namespace Org.OpenAPITools.Model
|
||||
|
||||
writer.WritePropertyName("mainShape");
|
||||
JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions);
|
||||
writer.WritePropertyName("shapeOrNull");
|
||||
JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions);
|
||||
writer.WritePropertyName("shapes");
|
||||
JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions);
|
||||
writer.WritePropertyName("nullableShape");
|
||||
JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions);
|
||||
writer.WritePropertyName("shapeOrNull");
|
||||
JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions);
|
||||
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
|
@ -1971,8 +1971,8 @@ components:
|
||||
type: string
|
||||
fruitReq:
|
||||
additionalProperties: false
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/appleReq'
|
||||
- $ref: '#/components/schemas/bananaReq'
|
||||
appleReq:
|
||||
@ -2021,8 +2021,8 @@ components:
|
||||
in OAS schema >= 3.1.
|
||||
discriminator:
|
||||
propertyName: shapeType
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/Triangle'
|
||||
- $ref: '#/components/schemas/Quadrilateral'
|
||||
NullableShape:
|
||||
|
@ -5,9 +5,9 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**MainShape** | [**Shape**](Shape.md) | | [optional]
|
||||
**ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional]
|
||||
**Shapes** | [**List<Shape>**](Shape.md) | | [optional]
|
||||
**NullableShape** | [**NullableShape**](NullableShape.md) | | [optional]
|
||||
**ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [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)
|
||||
|
||||
|
@ -32,16 +32,16 @@ namespace Org.OpenAPITools.Model
|
||||
/// Initializes a new instance of the <see cref="Drawing" /> class.
|
||||
/// </summary>
|
||||
/// <param name="mainShape">mainShape</param>
|
||||
/// <param name="shapeOrNull">shapeOrNull</param>
|
||||
/// <param name="shapes">shapes</param>
|
||||
/// <param name="nullableShape">nullableShape</param>
|
||||
/// <param name="shapeOrNull">shapeOrNull</param>
|
||||
[JsonConstructor]
|
||||
public Drawing(Shape mainShape, ShapeOrNull shapeOrNull, List<Shape> shapes, NullableShape nullableShape = default) : base()
|
||||
public Drawing(Shape mainShape, List<Shape> shapes, NullableShape nullableShape = default, ShapeOrNull shapeOrNull = default) : base()
|
||||
{
|
||||
MainShape = mainShape;
|
||||
ShapeOrNull = shapeOrNull;
|
||||
Shapes = shapes;
|
||||
NullableShape = nullableShape;
|
||||
ShapeOrNull = shapeOrNull;
|
||||
OnCreated();
|
||||
}
|
||||
|
||||
@ -53,12 +53,6 @@ namespace Org.OpenAPITools.Model
|
||||
[JsonPropertyName("mainShape")]
|
||||
public Shape MainShape { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeOrNull
|
||||
/// </summary>
|
||||
[JsonPropertyName("shapeOrNull")]
|
||||
public ShapeOrNull ShapeOrNull { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Shapes
|
||||
/// </summary>
|
||||
@ -71,6 +65,12 @@ namespace Org.OpenAPITools.Model
|
||||
[JsonPropertyName("nullableShape")]
|
||||
public NullableShape NullableShape { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeOrNull
|
||||
/// </summary>
|
||||
[JsonPropertyName("shapeOrNull")]
|
||||
public ShapeOrNull ShapeOrNull { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -81,9 +81,9 @@ namespace Org.OpenAPITools.Model
|
||||
sb.Append("class Drawing {\n");
|
||||
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
|
||||
sb.Append(" MainShape: ").Append(MainShape).Append("\n");
|
||||
sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append("\n");
|
||||
sb.Append(" Shapes: ").Append(Shapes).Append("\n");
|
||||
sb.Append(" NullableShape: ").Append(NullableShape).Append("\n");
|
||||
sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -122,9 +122,9 @@ namespace Org.OpenAPITools.Model
|
||||
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||
|
||||
Shape mainShape = default;
|
||||
ShapeOrNull shapeOrNull = default;
|
||||
List<Shape> shapes = default;
|
||||
NullableShape nullableShape = default;
|
||||
ShapeOrNull shapeOrNull = default;
|
||||
|
||||
while (utf8JsonReader.Read())
|
||||
{
|
||||
@ -145,10 +145,6 @@ namespace Org.OpenAPITools.Model
|
||||
if (utf8JsonReader.TokenType != JsonTokenType.Null)
|
||||
mainShape = JsonSerializer.Deserialize<Shape>(ref utf8JsonReader, jsonSerializerOptions);
|
||||
break;
|
||||
case "shapeOrNull":
|
||||
if (utf8JsonReader.TokenType != JsonTokenType.Null)
|
||||
shapeOrNull = JsonSerializer.Deserialize<ShapeOrNull>(ref utf8JsonReader, jsonSerializerOptions);
|
||||
break;
|
||||
case "shapes":
|
||||
if (utf8JsonReader.TokenType != JsonTokenType.Null)
|
||||
shapes = JsonSerializer.Deserialize<List<Shape>>(ref utf8JsonReader, jsonSerializerOptions);
|
||||
@ -157,6 +153,10 @@ namespace Org.OpenAPITools.Model
|
||||
if (utf8JsonReader.TokenType != JsonTokenType.Null)
|
||||
nullableShape = JsonSerializer.Deserialize<NullableShape>(ref utf8JsonReader, jsonSerializerOptions);
|
||||
break;
|
||||
case "shapeOrNull":
|
||||
if (utf8JsonReader.TokenType != JsonTokenType.Null)
|
||||
shapeOrNull = JsonSerializer.Deserialize<ShapeOrNull>(ref utf8JsonReader, jsonSerializerOptions);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -166,13 +166,10 @@ namespace Org.OpenAPITools.Model
|
||||
if (mainShape == null)
|
||||
throw new ArgumentNullException(nameof(mainShape), "Property is required for class Drawing.");
|
||||
|
||||
if (shapeOrNull == null)
|
||||
throw new ArgumentNullException(nameof(shapeOrNull), "Property is required for class Drawing.");
|
||||
|
||||
if (shapes == null)
|
||||
throw new ArgumentNullException(nameof(shapes), "Property is required for class Drawing.");
|
||||
|
||||
return new Drawing(mainShape, shapeOrNull, shapes, nullableShape);
|
||||
return new Drawing(mainShape, shapes, nullableShape, shapeOrNull);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -188,12 +185,12 @@ namespace Org.OpenAPITools.Model
|
||||
|
||||
writer.WritePropertyName("mainShape");
|
||||
JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions);
|
||||
writer.WritePropertyName("shapeOrNull");
|
||||
JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions);
|
||||
writer.WritePropertyName("shapes");
|
||||
JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions);
|
||||
writer.WritePropertyName("nullableShape");
|
||||
JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions);
|
||||
writer.WritePropertyName("shapeOrNull");
|
||||
JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions);
|
||||
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
|
@ -1971,8 +1971,8 @@ components:
|
||||
type: string
|
||||
fruitReq:
|
||||
additionalProperties: false
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/appleReq'
|
||||
- $ref: '#/components/schemas/bananaReq'
|
||||
appleReq:
|
||||
@ -2021,8 +2021,8 @@ components:
|
||||
in OAS schema >= 3.1.
|
||||
discriminator:
|
||||
propertyName: shapeType
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/Triangle'
|
||||
- $ref: '#/components/schemas/Quadrilateral'
|
||||
NullableShape:
|
||||
|
@ -5,9 +5,9 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**MainShape** | [**Shape**](Shape.md) | | [optional]
|
||||
**ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional]
|
||||
**Shapes** | [**List<Shape>**](Shape.md) | | [optional]
|
||||
**NullableShape** | [**NullableShape**](NullableShape.md) | | [optional]
|
||||
**ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [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)
|
||||
|
||||
|
@ -32,16 +32,16 @@ namespace Org.OpenAPITools.Model
|
||||
/// Initializes a new instance of the <see cref="Drawing" /> class.
|
||||
/// </summary>
|
||||
/// <param name="mainShape">mainShape</param>
|
||||
/// <param name="shapeOrNull">shapeOrNull</param>
|
||||
/// <param name="shapes">shapes</param>
|
||||
/// <param name="nullableShape">nullableShape</param>
|
||||
/// <param name="shapeOrNull">shapeOrNull</param>
|
||||
[JsonConstructor]
|
||||
public Drawing(Shape mainShape, ShapeOrNull shapeOrNull, List<Shape> shapes, NullableShape nullableShape = default) : base()
|
||||
public Drawing(Shape mainShape, List<Shape> shapes, NullableShape nullableShape = default, ShapeOrNull shapeOrNull = default) : base()
|
||||
{
|
||||
MainShape = mainShape;
|
||||
ShapeOrNull = shapeOrNull;
|
||||
Shapes = shapes;
|
||||
NullableShape = nullableShape;
|
||||
ShapeOrNull = shapeOrNull;
|
||||
OnCreated();
|
||||
}
|
||||
|
||||
@ -53,12 +53,6 @@ namespace Org.OpenAPITools.Model
|
||||
[JsonPropertyName("mainShape")]
|
||||
public Shape MainShape { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeOrNull
|
||||
/// </summary>
|
||||
[JsonPropertyName("shapeOrNull")]
|
||||
public ShapeOrNull ShapeOrNull { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Shapes
|
||||
/// </summary>
|
||||
@ -71,6 +65,12 @@ namespace Org.OpenAPITools.Model
|
||||
[JsonPropertyName("nullableShape")]
|
||||
public NullableShape NullableShape { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeOrNull
|
||||
/// </summary>
|
||||
[JsonPropertyName("shapeOrNull")]
|
||||
public ShapeOrNull ShapeOrNull { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -81,9 +81,9 @@ namespace Org.OpenAPITools.Model
|
||||
sb.Append("class Drawing {\n");
|
||||
sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
|
||||
sb.Append(" MainShape: ").Append(MainShape).Append("\n");
|
||||
sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append("\n");
|
||||
sb.Append(" Shapes: ").Append(Shapes).Append("\n");
|
||||
sb.Append(" NullableShape: ").Append(NullableShape).Append("\n");
|
||||
sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -122,9 +122,9 @@ namespace Org.OpenAPITools.Model
|
||||
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
|
||||
|
||||
Shape mainShape = default;
|
||||
ShapeOrNull shapeOrNull = default;
|
||||
List<Shape> shapes = default;
|
||||
NullableShape nullableShape = default;
|
||||
ShapeOrNull shapeOrNull = default;
|
||||
|
||||
while (utf8JsonReader.Read())
|
||||
{
|
||||
@ -145,10 +145,6 @@ namespace Org.OpenAPITools.Model
|
||||
if (utf8JsonReader.TokenType != JsonTokenType.Null)
|
||||
mainShape = JsonSerializer.Deserialize<Shape>(ref utf8JsonReader, jsonSerializerOptions);
|
||||
break;
|
||||
case "shapeOrNull":
|
||||
if (utf8JsonReader.TokenType != JsonTokenType.Null)
|
||||
shapeOrNull = JsonSerializer.Deserialize<ShapeOrNull>(ref utf8JsonReader, jsonSerializerOptions);
|
||||
break;
|
||||
case "shapes":
|
||||
if (utf8JsonReader.TokenType != JsonTokenType.Null)
|
||||
shapes = JsonSerializer.Deserialize<List<Shape>>(ref utf8JsonReader, jsonSerializerOptions);
|
||||
@ -157,6 +153,10 @@ namespace Org.OpenAPITools.Model
|
||||
if (utf8JsonReader.TokenType != JsonTokenType.Null)
|
||||
nullableShape = JsonSerializer.Deserialize<NullableShape>(ref utf8JsonReader, jsonSerializerOptions);
|
||||
break;
|
||||
case "shapeOrNull":
|
||||
if (utf8JsonReader.TokenType != JsonTokenType.Null)
|
||||
shapeOrNull = JsonSerializer.Deserialize<ShapeOrNull>(ref utf8JsonReader, jsonSerializerOptions);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -166,13 +166,10 @@ namespace Org.OpenAPITools.Model
|
||||
if (mainShape == null)
|
||||
throw new ArgumentNullException(nameof(mainShape), "Property is required for class Drawing.");
|
||||
|
||||
if (shapeOrNull == null)
|
||||
throw new ArgumentNullException(nameof(shapeOrNull), "Property is required for class Drawing.");
|
||||
|
||||
if (shapes == null)
|
||||
throw new ArgumentNullException(nameof(shapes), "Property is required for class Drawing.");
|
||||
|
||||
return new Drawing(mainShape, shapeOrNull, shapes, nullableShape);
|
||||
return new Drawing(mainShape, shapes, nullableShape, shapeOrNull);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -188,12 +185,12 @@ namespace Org.OpenAPITools.Model
|
||||
|
||||
writer.WritePropertyName("mainShape");
|
||||
JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions);
|
||||
writer.WritePropertyName("shapeOrNull");
|
||||
JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions);
|
||||
writer.WritePropertyName("shapes");
|
||||
JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions);
|
||||
writer.WritePropertyName("nullableShape");
|
||||
JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions);
|
||||
writer.WritePropertyName("shapeOrNull");
|
||||
JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions);
|
||||
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
|
@ -1971,8 +1971,8 @@ components:
|
||||
type: string
|
||||
fruitReq:
|
||||
additionalProperties: false
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/appleReq'
|
||||
- $ref: '#/components/schemas/bananaReq'
|
||||
appleReq:
|
||||
@ -2021,8 +2021,8 @@ components:
|
||||
in OAS schema >= 3.1.
|
||||
discriminator:
|
||||
propertyName: shapeType
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/Triangle'
|
||||
- $ref: '#/components/schemas/Quadrilateral'
|
||||
NullableShape:
|
||||
|
@ -57,7 +57,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeOrNull
|
||||
/// </summary>
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = false)]
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = true)]
|
||||
public ShapeOrNull ShapeOrNull { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -1971,8 +1971,8 @@ components:
|
||||
type: string
|
||||
fruitReq:
|
||||
additionalProperties: false
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/appleReq'
|
||||
- $ref: '#/components/schemas/bananaReq'
|
||||
appleReq:
|
||||
@ -2021,8 +2021,8 @@ components:
|
||||
in OAS schema >= 3.1.
|
||||
discriminator:
|
||||
propertyName: shapeType
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/Triangle'
|
||||
- $ref: '#/components/schemas/Quadrilateral'
|
||||
NullableShape:
|
||||
|
@ -56,7 +56,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeOrNull
|
||||
/// </summary>
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = false)]
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = true)]
|
||||
public ShapeOrNull ShapeOrNull { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -1971,8 +1971,8 @@ components:
|
||||
type: string
|
||||
fruitReq:
|
||||
additionalProperties: false
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/appleReq'
|
||||
- $ref: '#/components/schemas/bananaReq'
|
||||
appleReq:
|
||||
@ -2021,8 +2021,8 @@ components:
|
||||
in OAS schema >= 3.1.
|
||||
discriminator:
|
||||
propertyName: shapeType
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/Triangle'
|
||||
- $ref: '#/components/schemas/Quadrilateral'
|
||||
NullableShape:
|
||||
|
@ -56,7 +56,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeOrNull
|
||||
/// </summary>
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = false)]
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = true)]
|
||||
public ShapeOrNull ShapeOrNull { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -1971,8 +1971,8 @@ components:
|
||||
type: string
|
||||
fruitReq:
|
||||
additionalProperties: false
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/appleReq'
|
||||
- $ref: '#/components/schemas/bananaReq'
|
||||
appleReq:
|
||||
@ -2021,8 +2021,8 @@ components:
|
||||
in OAS schema >= 3.1.
|
||||
discriminator:
|
||||
propertyName: shapeType
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/Triangle'
|
||||
- $ref: '#/components/schemas/Quadrilateral'
|
||||
NullableShape:
|
||||
|
@ -56,7 +56,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeOrNull
|
||||
/// </summary>
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = false)]
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = true)]
|
||||
public ShapeOrNull ShapeOrNull { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -1971,8 +1971,8 @@ components:
|
||||
type: string
|
||||
fruitReq:
|
||||
additionalProperties: false
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/appleReq'
|
||||
- $ref: '#/components/schemas/bananaReq'
|
||||
appleReq:
|
||||
@ -2021,8 +2021,8 @@ components:
|
||||
in OAS schema >= 3.1.
|
||||
discriminator:
|
||||
propertyName: shapeType
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/Triangle'
|
||||
- $ref: '#/components/schemas/Quadrilateral'
|
||||
NullableShape:
|
||||
|
@ -54,7 +54,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeOrNull
|
||||
/// </summary>
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = false)]
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = true)]
|
||||
public ShapeOrNull ShapeOrNull { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -1971,8 +1971,8 @@ components:
|
||||
type: string
|
||||
fruitReq:
|
||||
additionalProperties: false
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/appleReq'
|
||||
- $ref: '#/components/schemas/bananaReq'
|
||||
appleReq:
|
||||
@ -2021,8 +2021,8 @@ components:
|
||||
in OAS schema >= 3.1.
|
||||
discriminator:
|
||||
propertyName: shapeType
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/Triangle'
|
||||
- $ref: '#/components/schemas/Quadrilateral'
|
||||
NullableShape:
|
||||
|
@ -56,7 +56,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeOrNull
|
||||
/// </summary>
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = false)]
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = true)]
|
||||
public ShapeOrNull ShapeOrNull { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -1971,8 +1971,8 @@ components:
|
||||
type: string
|
||||
fruitReq:
|
||||
additionalProperties: false
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/appleReq'
|
||||
- $ref: '#/components/schemas/bananaReq'
|
||||
appleReq:
|
||||
@ -2021,8 +2021,8 @@ components:
|
||||
in OAS schema >= 3.1.
|
||||
discriminator:
|
||||
propertyName: shapeType
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/Triangle'
|
||||
- $ref: '#/components/schemas/Quadrilateral'
|
||||
NullableShape:
|
||||
|
@ -56,7 +56,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeOrNull
|
||||
/// </summary>
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = false)]
|
||||
[DataMember(Name = "shapeOrNull", EmitDefaultValue = true)]
|
||||
public ShapeOrNull ShapeOrNull { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -1973,8 +1973,8 @@ components:
|
||||
type: string
|
||||
fruitReq:
|
||||
additionalProperties: false
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/appleReq'
|
||||
- $ref: '#/components/schemas/bananaReq'
|
||||
appleReq:
|
||||
@ -2023,8 +2023,8 @@ components:
|
||||
in OAS schema >= 3.1.
|
||||
discriminator:
|
||||
propertyName: shapeType
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/Triangle'
|
||||
- $ref: '#/components/schemas/Quadrilateral'
|
||||
NullableShape:
|
||||
|
@ -55,7 +55,7 @@ public class Drawing {
|
||||
private Shape mainShape;
|
||||
|
||||
public static final String JSON_PROPERTY_SHAPE_OR_NULL = "shapeOrNull";
|
||||
private ShapeOrNull shapeOrNull;
|
||||
private JsonNullable<ShapeOrNull> shapeOrNull = JsonNullable.<ShapeOrNull>undefined();
|
||||
|
||||
public static final String JSON_PROPERTY_NULLABLE_SHAPE = "nullableShape";
|
||||
private JsonNullable<NullableShape> nullableShape = JsonNullable.<NullableShape>undefined();
|
||||
@ -92,7 +92,7 @@ public class Drawing {
|
||||
|
||||
|
||||
public Drawing shapeOrNull(ShapeOrNull shapeOrNull) {
|
||||
this.shapeOrNull = shapeOrNull;
|
||||
this.shapeOrNull = JsonNullable.<ShapeOrNull>of(shapeOrNull);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -101,20 +101,28 @@ public class Drawing {
|
||||
* @return shapeOrNull
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
@JsonIgnore
|
||||
|
||||
public ShapeOrNull getShapeOrNull() {
|
||||
return shapeOrNull;
|
||||
return shapeOrNull.orElse(null);
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setShapeOrNull(ShapeOrNull shapeOrNull) {
|
||||
|
||||
public JsonNullable<ShapeOrNull> getShapeOrNull_JsonNullable() {
|
||||
return shapeOrNull;
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL)
|
||||
public void setShapeOrNull_JsonNullable(JsonNullable<ShapeOrNull> shapeOrNull) {
|
||||
this.shapeOrNull = shapeOrNull;
|
||||
}
|
||||
|
||||
public void setShapeOrNull(ShapeOrNull shapeOrNull) {
|
||||
this.shapeOrNull = JsonNullable.<ShapeOrNull>of(shapeOrNull);
|
||||
}
|
||||
|
||||
|
||||
public Drawing nullableShape(NullableShape nullableShape) {
|
||||
this.nullableShape = JsonNullable.<NullableShape>of(nullableShape);
|
||||
@ -232,7 +240,7 @@ public class Drawing {
|
||||
}
|
||||
Drawing drawing = (Drawing) o;
|
||||
return Objects.equals(this.mainShape, drawing.mainShape) &&
|
||||
Objects.equals(this.shapeOrNull, drawing.shapeOrNull) &&
|
||||
equalsNullable(this.shapeOrNull, drawing.shapeOrNull) &&
|
||||
equalsNullable(this.nullableShape, drawing.nullableShape) &&
|
||||
Objects.equals(this.shapes, drawing.shapes)&&
|
||||
Objects.equals(this.additionalProperties, drawing.additionalProperties);
|
||||
@ -244,7 +252,7 @@ public class Drawing {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(mainShape, shapeOrNull, hashCodeNullable(nullableShape), shapes, additionalProperties);
|
||||
return Objects.hash(mainShape, hashCodeNullable(shapeOrNull), hashCodeNullable(nullableShape), shapes, additionalProperties);
|
||||
}
|
||||
|
||||
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||
|
@ -1973,8 +1973,8 @@ components:
|
||||
type: string
|
||||
fruitReq:
|
||||
additionalProperties: false
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/appleReq'
|
||||
- $ref: '#/components/schemas/bananaReq'
|
||||
appleReq:
|
||||
@ -2023,8 +2023,8 @@ components:
|
||||
in OAS schema >= 3.1.
|
||||
discriminator:
|
||||
propertyName: shapeType
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/Triangle'
|
||||
- $ref: '#/components/schemas/Quadrilateral'
|
||||
NullableShape:
|
||||
|
@ -512,7 +512,7 @@ export interface Drawing {
|
||||
* @type {ShapeOrNull}
|
||||
* @memberof Drawing
|
||||
*/
|
||||
'shapeOrNull'?: ShapeOrNull;
|
||||
'shapeOrNull'?: ShapeOrNull | null;
|
||||
/**
|
||||
*
|
||||
* @type {NullableShape}
|
||||
@ -846,7 +846,7 @@ export type Fruit = Apple | Banana;
|
||||
* @type FruitReq
|
||||
* @export
|
||||
*/
|
||||
export type FruitReq = AppleReq | BananaReq | Null;
|
||||
export type FruitReq = AppleReq | BananaReq;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1520,7 +1520,7 @@ export interface ShapeInterface {
|
||||
* The value may be a shape or the \'null\' value. This is introduced in OAS schema >= 3.1.
|
||||
* @export
|
||||
*/
|
||||
export type ShapeOrNull = Null | Quadrilateral | Triangle;
|
||||
export type ShapeOrNull = Quadrilateral | Triangle;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -1973,8 +1973,8 @@ components:
|
||||
type: string
|
||||
fruitReq:
|
||||
additionalProperties: false
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/appleReq'
|
||||
- $ref: '#/components/schemas/bananaReq'
|
||||
appleReq:
|
||||
@ -2023,8 +2023,8 @@ components:
|
||||
in OAS schema >= 3.1.
|
||||
discriminator:
|
||||
propertyName: shapeType
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: "null"
|
||||
- $ref: '#/components/schemas/Triangle'
|
||||
- $ref: '#/components/schemas/Quadrilateral'
|
||||
NullableShape:
|
||||
|
@ -55,7 +55,7 @@ public class Drawing {
|
||||
private Shape mainShape;
|
||||
|
||||
public static final String JSON_PROPERTY_SHAPE_OR_NULL = "shapeOrNull";
|
||||
private ShapeOrNull shapeOrNull;
|
||||
private JsonNullable<ShapeOrNull> shapeOrNull = JsonNullable.<ShapeOrNull>undefined();
|
||||
|
||||
public static final String JSON_PROPERTY_NULLABLE_SHAPE = "nullableShape";
|
||||
private JsonNullable<NullableShape> nullableShape = JsonNullable.<NullableShape>undefined();
|
||||
@ -92,7 +92,7 @@ public class Drawing {
|
||||
|
||||
|
||||
public Drawing shapeOrNull(ShapeOrNull shapeOrNull) {
|
||||
this.shapeOrNull = shapeOrNull;
|
||||
this.shapeOrNull = JsonNullable.<ShapeOrNull>of(shapeOrNull);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -101,20 +101,28 @@ public class Drawing {
|
||||
* @return shapeOrNull
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
@JsonIgnore
|
||||
|
||||
public ShapeOrNull getShapeOrNull() {
|
||||
return shapeOrNull;
|
||||
return shapeOrNull.orElse(null);
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setShapeOrNull(ShapeOrNull shapeOrNull) {
|
||||
|
||||
public JsonNullable<ShapeOrNull> getShapeOrNull_JsonNullable() {
|
||||
return shapeOrNull;
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL)
|
||||
public void setShapeOrNull_JsonNullable(JsonNullable<ShapeOrNull> shapeOrNull) {
|
||||
this.shapeOrNull = shapeOrNull;
|
||||
}
|
||||
|
||||
public void setShapeOrNull(ShapeOrNull shapeOrNull) {
|
||||
this.shapeOrNull = JsonNullable.<ShapeOrNull>of(shapeOrNull);
|
||||
}
|
||||
|
||||
|
||||
public Drawing nullableShape(NullableShape nullableShape) {
|
||||
this.nullableShape = JsonNullable.<NullableShape>of(nullableShape);
|
||||
@ -232,7 +240,7 @@ public class Drawing {
|
||||
}
|
||||
Drawing drawing = (Drawing) o;
|
||||
return Objects.equals(this.mainShape, drawing.mainShape) &&
|
||||
Objects.equals(this.shapeOrNull, drawing.shapeOrNull) &&
|
||||
equalsNullable(this.shapeOrNull, drawing.shapeOrNull) &&
|
||||
equalsNullable(this.nullableShape, drawing.nullableShape) &&
|
||||
Objects.equals(this.shapes, drawing.shapes)&&
|
||||
Objects.equals(this.additionalProperties, drawing.additionalProperties);
|
||||
@ -244,7 +252,7 @@ public class Drawing {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(mainShape, shapeOrNull, hashCodeNullable(nullableShape), shapes, additionalProperties);
|
||||
return Objects.hash(mainShape, hashCodeNullable(shapeOrNull), hashCodeNullable(nullableShape), shapes, additionalProperties);
|
||||
}
|
||||
|
||||
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user