Skip to content

Commit 29536fa

Browse files
committed
trigger build failure
1 parent 145789e commit 29536fa

72 files changed

Lines changed: 944 additions & 924 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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,8 @@ 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+
576578
}
577579
}
578580
}
@@ -722,7 +724,7 @@ protected boolean isSelfReference(String name, Schema subSchema) {
722724
*/
723725
public Schema normalizeSchema(Schema schema, Set<Schema> visitedSchemas) {
724726
// normalize reference schema
725-
if (StringUtils.isNotEmpty(schema.get$ref())) {
727+
if (schema != null && StringUtils.isNotEmpty(schema.get$ref())) {
726728
normalizeReferenceSchema(schema);
727729
}
728730

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +0,0 @@
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
@@ -1,64 +0,0 @@
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** | **CopyActivityAllOfSchema** | |
8+
**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
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 CopyActivityAllOfSchema copyActivityAllOfSchema)
162-
return CopyActivityAllOfSchemaValueConverter.ToJsonValue(copyActivityAllOfSchema);
161+
if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
162+
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
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: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ 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());
6866
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
6967
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
7068
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());

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

Lines changed: 69 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,77 @@ 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);
3940
CopyActivitytt = copyActivitytt;
40-
Schema = (CopyActivityAllOfSchema)Enum.Parse(typeof(CopyActivityAllOfSchema), this.GetType().Name);
4141
OnCreated();
4242
}
4343

4444
partial void OnCreated();
4545

4646
/// <summary>
47-
/// Gets or Sets CopyActivitytt
47+
/// Defines Schema
4848
/// </summary>
49-
[JsonPropertyName("copyActivitytt")]
50-
public string CopyActivitytt { get; set; }
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
86+
/// </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+
}
5197

5298
/// <summary>
5399
/// The discriminator
54100
/// </summary>
55101
[JsonIgnore]
56102
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
57-
public new CopyActivityAllOfSchema Schema { get; }
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; }
58110

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

94146
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
95147

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

99151
while (utf8JsonReader.Read())
100152
{
@@ -111,32 +163,32 @@ public override CopyActivity Read(ref Utf8JsonReader utf8JsonReader, Type typeTo
111163

112164
switch (localVarJsonPropertyName)
113165
{
114-
case "copyActivitytt":
115-
copyActivitytt = new Option<string>(utf8JsonReader.GetString());
116-
break;
117166
case "$schema":
118167
string schemaRawValue = utf8JsonReader.GetString();
119168
if (schemaRawValue != null)
120-
schema = new Option<CopyActivityAllOfSchema?>(CopyActivityAllOfSchemaValueConverter.FromStringOrDefault(schemaRawValue));
169+
schema = new Option<CopyActivity.SchemaEnum?>(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
170+
break;
171+
case "copyActivitytt":
172+
copyActivitytt = new Option<string>(utf8JsonReader.GetString());
121173
break;
122174
default:
123175
break;
124176
}
125177
}
126178
}
127179

128-
if (!copyActivitytt.IsSet)
129-
throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
130-
131180
if (!schema.IsSet)
132181
throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
133182

134-
if (copyActivitytt.IsSet && copyActivitytt.Value == null)
135-
throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
183+
if (!copyActivitytt.IsSet)
184+
throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
136185

137186
if (schema.IsSet && schema.Value == null)
138187
throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
139188

189+
if (copyActivitytt.IsSet && copyActivitytt.Value == null)
190+
throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
191+
140192
return new CopyActivity(copyActivitytt.Value);
141193
}
142194

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

170-
writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
222+
writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
171223

172-
writer.WriteString("$schema", CopyActivityAllOfSchemaValueConverter.ToJsonValue(copyActivity.Schema));
224+
writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
173225
}
174226
}
175227
}

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ 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+
200203
if (shapes.IsSet && shapes.Value == null)
201204
throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing.");
202205

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

236+
if (drawing.ShapeOrNullOption.IsSet && drawing.ShapeOrNull == null)
237+
throw new ArgumentNullException(nameof(drawing.ShapeOrNull), "Property is required for class Drawing.");
238+
233239
if (drawing.ShapesOption.IsSet && drawing.Shapes == null)
234240
throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing.");
235241

@@ -247,13 +253,10 @@ public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializ
247253
else
248254
writer.WriteNull("nullableShape");
249255
if (drawing.ShapeOrNullOption.IsSet)
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");
256+
{
257+
writer.WritePropertyName("shapeOrNull");
258+
JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions);
259+
}
257260
if (drawing.ShapesOption.IsSet)
258261
{
259262
writer.WritePropertyName("shapes");

0 commit comments

Comments
 (0)