Skip to content

Commit 443ff4f

Browse files
committed
Revert "trigger build failure"
This reverts commit 29536fa.
1 parent 29536fa commit 443ff4f

72 files changed

Lines changed: 924 additions & 944 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,6 @@ protected void normalizeHeaders(Map<String, Header> headers) {
573573
// $ref: #/components/headers/Location
574574
Schema updatedHeader = normalizeSchema(h.getSchema(), new HashSet<>());
575575
h.setSchema(updatedHeader);
576-
throw new RuntimeException("trigger build failure");
577-
578576
}
579577
}
580578
}
@@ -724,7 +722,7 @@ protected boolean isSelfReference(String name, Schema subSchema) {
724722
*/
725723
public Schema normalizeSchema(Schema schema, Set<Schema> visitedSchemas) {
726724
// normalize reference schema
727-
if (schema != null && StringUtils.isNotEmpty(schema.get$ref())) {
725+
if (StringUtils.isNotEmpty(schema.get$ref())) {
728726
normalizeReferenceSchema(schema);
729727
}
730728

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/**
2+
*
3+
* Please note:
4+
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
5+
* Do not edit this file manually.
6+
*
7+
*/
8+
9+
@file:Suppress(
10+
"ArrayInDataClass",
11+
"EnumEntryName",
12+
"RemoveRedundantQualifierName",
13+
"UnusedImport"
14+
)
15+
16+
package org.openapitools.client.apis
17+
18+
import com.fasterxml.jackson.annotation.JsonProperty
19+
20+
import org.springframework.web.reactive.function.client.WebClient
21+
import org.springframework.web.reactive.function.client.WebClientResponseException
22+
import org.springframework.http.codec.json.Jackson2JsonDecoder
23+
import org.springframework.http.codec.json.Jackson2JsonEncoder
24+
import org.springframework.http.ResponseEntity
25+
import org.springframework.http.MediaType
26+
import reactor.core.publisher.Mono
27+
import org.springframework.util.LinkedMultiValueMap
28+
29+
import org.openapitools.client.models.StringEnumRef
30+
import org.openapitools.client.infrastructure.*
31+
32+
open class HeaderApi(client: WebClient) : ApiClient(client) {
33+
34+
constructor(baseUrl: String) : this(WebClient.builder()
35+
.baseUrl(baseUrl)
36+
.codecs {
37+
it.defaultCodecs().jackson2JsonEncoder(Jackson2JsonEncoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
38+
it.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
39+
}
40+
.build()
41+
)
42+
43+
/**
44+
* enum for parameter enumNonrefStringHeader
45+
*/
46+
enum class EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums(val value: kotlin.String) {
47+
@JsonProperty(value = "success") success("success"),
48+
@JsonProperty(value = "failure") failure("failure"),
49+
@JsonProperty(value = "unclassified") unclassified("unclassified"),
50+
}
51+
52+
53+
@Throws(WebClientResponseException::class)
54+
fun testHeaderIntegerBooleanStringEnums(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null): Mono<kotlin.String> {
55+
return testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader)
56+
.map { it.body!! }
57+
}
58+
59+
@Throws(WebClientResponseException::class)
60+
fun testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null): Mono<ResponseEntity<kotlin.String>> {
61+
val localVariableConfig = testHeaderIntegerBooleanStringEnumsRequestConfig(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader)
62+
return request<Unit, kotlin.String>(
63+
localVariableConfig
64+
)
65+
}
66+
67+
fun testHeaderIntegerBooleanStringEnumsRequestConfig(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null) : RequestConfig<Unit> {
68+
val localVariableBody = null
69+
val localVariableQuery = mutableMapOf<kotlin.String, kotlin.collections.List<kotlin.String>>()
70+
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
71+
integerHeader?.apply { localVariableHeaders["integer_header"] = this.toString() }
72+
booleanHeader?.apply { localVariableHeaders["boolean_header"] = this.toString() }
73+
stringHeader?.apply { localVariableHeaders["string_header"] = this.toString() }
74+
enumNonrefStringHeader?.apply { localVariableHeaders["enum_nonref_string_header"] = this.toString() }
75+
enumRefStringHeader?.apply { localVariableHeaders["enum_ref_string_header"] = this.toString() }
76+
localVariableHeaders["Accept"] = "text/plain"
77+
78+
val params = mutableMapOf<String, Any>(
79+
)
80+
81+
return RequestConfig(
82+
method = RequestMethod.GET,
83+
path = "/header/integer/boolean/string/enums",
84+
params = params,
85+
query = localVariableQuery,
86+
headers = localVariableHeaders,
87+
requiresAuthentication = false,
88+
body = localVariableBody
89+
)
90+
}
91+
92+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/**
2+
*
3+
* Please note:
4+
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
5+
* Do not edit this file manually.
6+
*
7+
*/
8+
9+
@file:Suppress(
10+
"ArrayInDataClass",
11+
"EnumEntryName",
12+
"RemoveRedundantQualifierName",
13+
"UnusedImport"
14+
)
15+
16+
package org.openapitools.client.models
17+
18+
19+
import com.google.gson.annotations.SerializedName
20+
21+
/**
22+
*
23+
*
24+
* Values: SUCCESS,FAILURE,UNCLASSIFIED
25+
*/
26+
27+
enum class ApiStringEnumRef(val value: kotlin.String) {
28+
29+
@SerializedName(value = "success")
30+
SUCCESS("success"),
31+
32+
@SerializedName(value = "failure")
33+
FAILURE("failure"),
34+
35+
@SerializedName(value = "unclassified")
36+
UNCLASSIFIED("unclassified");
37+
38+
/**
39+
* Override [toString()] to avoid using the enum variable name as the value, and instead use
40+
* the actual value defined in the API spec file.
41+
*
42+
* This solves a problem when the variable name and its value are different, and ensures that
43+
* the client sends the correct enum values to the server always.
44+
*/
45+
override fun toString(): kotlin.String = value
46+
47+
companion object {
48+
/**
49+
* Converts the provided [data] to a [String] on success, null otherwise.
50+
*/
51+
fun encode(data: kotlin.Any?): kotlin.String? = if (data is ApiStringEnumRef) "$data" else null
52+
53+
/**
54+
* Returns a valid [ApiStringEnumRef] for [data], null otherwise.
55+
*/
56+
fun decode(data: kotlin.Any?): ApiStringEnumRef? = data?.let {
57+
val normalizedData = "$it".lowercase()
58+
values().firstOrNull { value ->
59+
it == value || normalizedData == "$value".lowercase()
60+
}
61+
}
62+
}
63+
}
64+

samples/client/petstore/csharp/generichost/net10/FormModels/docs/models/CopyActivity.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
77
**CopyActivitytt** | **string** | |
8-
**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
8+
**Schema** | **CopyActivityAllOfSchema** | |
99

1010
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
1111

samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET
158158
: "false";
159159
if (obj is ChildCatAllOfPetType childCatAllOfPetType)
160160
return ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCatAllOfPetType);
161-
if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
162-
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
161+
if (obj is CopyActivityAllOfSchema copyActivityAllOfSchema)
162+
return CopyActivityAllOfSchemaValueConverter.ToJsonValue(copyActivityAllOfSchema);
163163
if (obj is EnumArraysArrayEnumInner enumArraysArrayEnumInner)
164164
return EnumArraysArrayEnumInnerValueConverter.ToJsonValue(enumArraysArrayEnumInner);
165165
if (obj is EnumArraysJustSymbol enumArraysJustSymbol)

samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ public HostConfiguration(IServiceCollection services)
6363
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
6464
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
6565
_jsonOptions.Converters.Add(new CopyActivityJsonConverter());
66+
_jsonOptions.Converters.Add(new CopyActivityAllOfSchemaJsonConverter());
67+
_jsonOptions.Converters.Add(new CopyActivityAllOfSchemaNullableJsonConverter());
6668
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
6769
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
6870
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());

samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs

Lines changed: 17 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -36,77 +36,25 @@ public partial class CopyActivity : EntityBase, IValidatableObject
3636
[JsonConstructor]
3737
public CopyActivity(string copyActivitytt) : base()
3838
{
39-
Schema = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), this.GetType().Name);
4039
CopyActivitytt = copyActivitytt;
40+
Schema = (CopyActivityAllOfSchema)Enum.Parse(typeof(CopyActivityAllOfSchema), this.GetType().Name);
4141
OnCreated();
4242
}
4343

4444
partial void OnCreated();
4545

4646
/// <summary>
47-
/// Defines Schema
48-
/// </summary>
49-
public enum SchemaEnum
50-
{
51-
/// <summary>
52-
/// Enum ScopeActivity for value: ScopeActivity
53-
/// </summary>
54-
ScopeActivity = 1
55-
}
56-
57-
/// <summary>
58-
/// Returns a <see cref="SchemaEnum"/>
59-
/// </summary>
60-
/// <param name="value"></param>
61-
/// <returns></returns>
62-
/// <exception cref="NotImplementedException"></exception>
63-
public static SchemaEnum SchemaEnumFromString(string value)
64-
{
65-
if (value.Equals("ScopeActivity"))
66-
return SchemaEnum.ScopeActivity;
67-
68-
throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
69-
}
70-
71-
/// <summary>
72-
/// Returns a <see cref="SchemaEnum"/>
73-
/// </summary>
74-
/// <param name="value"></param>
75-
/// <returns></returns>
76-
public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
77-
{
78-
if (value.Equals("ScopeActivity"))
79-
return SchemaEnum.ScopeActivity;
80-
81-
return null;
82-
}
83-
84-
/// <summary>
85-
/// Converts the <see cref="SchemaEnum"/> to the json value
47+
/// Gets or Sets CopyActivitytt
8648
/// </summary>
87-
/// <param name="value"></param>
88-
/// <returns></returns>
89-
/// <exception cref="NotImplementedException"></exception>
90-
public static string SchemaEnumToJsonValue(SchemaEnum value)
91-
{
92-
if (value == SchemaEnum.ScopeActivity)
93-
return "ScopeActivity";
94-
95-
throw new NotImplementedException($"Value could not be handled: '{value}'");
96-
}
49+
[JsonPropertyName("copyActivitytt")]
50+
public string CopyActivitytt { get; set; }
9751

9852
/// <summary>
9953
/// The discriminator
10054
/// </summary>
10155
[JsonIgnore]
10256
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
103-
public new SchemaEnum Schema { get; }
104-
105-
/// <summary>
106-
/// Gets or Sets CopyActivitytt
107-
/// </summary>
108-
[JsonPropertyName("copyActivitytt")]
109-
public string CopyActivitytt { get; set; }
57+
public new CopyActivityAllOfSchema Schema { get; }
11058

11159
/// <summary>
11260
/// Returns the string presentation of the object
@@ -145,8 +93,8 @@ public override CopyActivity Read(ref Utf8JsonReader utf8JsonReader, Type typeTo
14593

14694
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
14795

148-
Option<CopyActivity.SchemaEnum?> schema = default;
14996
Option<string> copyActivitytt = default;
97+
Option<CopyActivityAllOfSchema?> schema = default;
15098

15199
while (utf8JsonReader.Read())
152100
{
@@ -163,32 +111,32 @@ public override CopyActivity Read(ref Utf8JsonReader utf8JsonReader, Type typeTo
163111

164112
switch (localVarJsonPropertyName)
165113
{
114+
case "copyActivitytt":
115+
copyActivitytt = new Option<string>(utf8JsonReader.GetString());
116+
break;
166117
case "$schema":
167118
string schemaRawValue = utf8JsonReader.GetString();
168119
if (schemaRawValue != null)
169-
schema = new Option<CopyActivity.SchemaEnum?>(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
170-
break;
171-
case "copyActivitytt":
172-
copyActivitytt = new Option<string>(utf8JsonReader.GetString());
120+
schema = new Option<CopyActivityAllOfSchema?>(CopyActivityAllOfSchemaValueConverter.FromStringOrDefault(schemaRawValue));
173121
break;
174122
default:
175123
break;
176124
}
177125
}
178126
}
179127

180-
if (!schema.IsSet)
181-
throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
182-
183128
if (!copyActivitytt.IsSet)
184129
throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
185130

186-
if (schema.IsSet && schema.Value == null)
187-
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
131+
if (!schema.IsSet)
132+
throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
188133

189134
if (copyActivitytt.IsSet && copyActivitytt.Value == null)
190135
throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
191136

137+
if (schema.IsSet && schema.Value == null)
138+
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
139+
192140
return new CopyActivity(copyActivitytt.Value);
193141
}
194142

@@ -219,9 +167,9 @@ public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, Js
219167
if (copyActivity.CopyActivitytt == null)
220168
throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
221169

222-
writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
223-
224170
writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
171+
172+
writer.WriteString("$schema", CopyActivityAllOfSchemaValueConverter.ToJsonValue(copyActivity.Schema));
225173
}
226174
}
227175
}

samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Drawing.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,6 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve
197197
if (mainShape.IsSet && mainShape.Value == null)
198198
throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing.");
199199

200-
if (shapeOrNull.IsSet && shapeOrNull.Value == null)
201-
throw new ArgumentNullException(nameof(shapeOrNull), "Property is not nullable for class Drawing.");
202-
203200
if (shapes.IsSet && shapes.Value == null)
204201
throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing.");
205202

@@ -233,9 +230,6 @@ public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializ
233230
if (drawing.MainShapeOption.IsSet && drawing.MainShape == null)
234231
throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing.");
235232

236-
if (drawing.ShapeOrNullOption.IsSet && drawing.ShapeOrNull == null)
237-
throw new ArgumentNullException(nameof(drawing.ShapeOrNull), "Property is required for class Drawing.");
238-
239233
if (drawing.ShapesOption.IsSet && drawing.Shapes == null)
240234
throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing.");
241235

@@ -253,10 +247,13 @@ public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializ
253247
else
254248
writer.WriteNull("nullableShape");
255249
if (drawing.ShapeOrNullOption.IsSet)
256-
{
257-
writer.WritePropertyName("shapeOrNull");
258-
JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions);
259-
}
250+
if (drawing.ShapeOrNullOption.Value != null)
251+
{
252+
writer.WritePropertyName("shapeOrNull");
253+
JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions);
254+
}
255+
else
256+
writer.WriteNull("shapeOrNull");
260257
if (drawing.ShapesOption.IsSet)
261258
{
262259
writer.WritePropertyName("shapes");

0 commit comments

Comments
 (0)