Skip to content

Commit f853632

Browse files
committed
Fix test case
1 parent a4d11cc commit f853632

5 files changed

Lines changed: 50 additions & 31 deletions

File tree

  • samples
    • client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Client
    • server/others/kotlin-server/polymorphism-allof-and-discriminator

samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Client/ClientUtils.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,35 @@ public static bool IsJsonMime(string mime)
301301
throw new JsonException("The specified discriminator was not found.");
302302
}
303303

304+
/// <summary>
305+
/// Determines if the provided header is a content header
306+
/// </summary>
307+
/// <param name="header">The header to check</param>
308+
/// <returns>True if a content header; False otherwise</returns>
309+
public static bool IsContentHeader(string header)
310+
{
311+
return ContentHeaders.Contains(header.ToLowerInvariant());
312+
}
313+
314+
/// <summary>
315+
/// The collection of content headers as per
316+
/// https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpcontent.headers
317+
/// </summary>
318+
private static readonly string[] ContentHeaders = new String[]
319+
{
320+
"allow",
321+
"content-encoding",
322+
"content-disposition",
323+
"content-language",
324+
"content-length",
325+
"content-location",
326+
"content-md5",
327+
"content-range",
328+
"content-type",
329+
"expires",
330+
"last-modified"
331+
};
332+
304333
/// <summary>
305334
/// The base path of the API
306335
/// </summary>

samples/server/others/kotlin-server/polymorphism-allof-and-discriminator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# org.openapitools.server - Kotlin Server library for Polymorphism example with allOf and discriminator
1+
# org.openapitools.server - Kotlin Server library for Basic polymorphism example with discriminator
22

33
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
44

samples/server/others/kotlin-server/polymorphism-allof-and-discriminator/src/main/kotlin/org/openapitools/server/models/Cat.kt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Polymorphism example with allOf and discriminator
2+
* Basic polymorphism example with discriminator
33
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
44
*
55
* The version of the OpenAPI document: 1.0
@@ -11,24 +11,22 @@
1111
*/
1212
package org.openapitools.server.models
1313

14-
import org.openapitools.server.models.Pet
1514

1615
/**
17-
* A representation of a cat
16+
* A pet cat
1817
* @param huntingSkill The measured skill for hunting
18+
* @param petType
1919
*/
2020
data class Cat(
2121
/* The measured skill for hunting */
2222

2323
@field:com.fasterxml.jackson.annotation.JsonProperty("huntingSkill")
2424
val huntingSkill: Cat.HuntingSkill,
2525

26-
@field:com.fasterxml.jackson.annotation.JsonProperty("name")
27-
override val name: kotlin.String,
28-
2926
@field:com.fasterxml.jackson.annotation.JsonProperty("petType")
30-
override val petType: kotlin.String
31-
) : Pet(name = name, petType = petType)
27+
override val petType: kotlin.String = "cat",
28+
29+
) : Pet(petType = petType)
3230
{
3331
/**
3432
* The measured skill for hunting
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Polymorphism example with allOf and discriminator
2+
* Basic polymorphism example with discriminator
33
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
44
*
55
* The version of the OpenAPI document: 1.0
@@ -11,24 +11,19 @@
1111
*/
1212
package org.openapitools.server.models
1313

14-
import org.openapitools.server.models.Pet
1514

1615
/**
17-
* A representation of a dog
16+
* A pet dog
17+
* @param petType
1818
* @param packSize the size of the pack the dog is from
1919
*/
2020
data class Dog(
21+
22+
@field:com.fasterxml.jackson.annotation.JsonProperty("petType")
23+
override val petType: kotlin.String = "dog",
2124
/* the size of the pack the dog is from */
2225

2326
@field:com.fasterxml.jackson.annotation.JsonProperty("packSize")
24-
val packSize: kotlin.Int = 0,
25-
26-
@field:com.fasterxml.jackson.annotation.JsonProperty("name")
27-
override val name: kotlin.String,
28-
29-
@field:com.fasterxml.jackson.annotation.JsonProperty("petType")
30-
override val petType: kotlin.String
31-
) : Pet(name = name, petType = petType)
32-
{
33-
}
27+
val packSize: kotlin.Int = 0
28+
) : Pet(petType = petType)
3429

samples/server/others/kotlin-server/polymorphism-allof-and-discriminator/src/main/kotlin/org/openapitools/server/models/Pet.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Polymorphism example with allOf and discriminator
2+
* Basic polymorphism example with discriminator
33
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
44
*
55
* The version of the OpenAPI document: 1.0
@@ -11,23 +11,20 @@
1111
*/
1212
package org.openapitools.server.models
1313

14+
import org.openapitools.server.models.Cat
15+
import org.openapitools.server.models.Dog
1416

1517
/**
16-
*
17-
* @param name
18+
* A pet
1819
* @param petType
1920
*/
2021
@com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, include = com.fasterxml.jackson.annotation.JsonTypeInfo.As.PROPERTY, property = "petType", visible = true)
2122
@com.fasterxml.jackson.annotation.JsonSubTypes(
22-
com.fasterxml.jackson.annotation.JsonSubTypes.Type(value = Cat::class, name = "Cat"),
23-
com.fasterxml.jackson.annotation.JsonSubTypes.Type(value = Dog::class, name = "Dog")
23+
com.fasterxml.jackson.annotation.JsonSubTypes.Type(value = Cat::class, name = "cat"),
24+
com.fasterxml.jackson.annotation.JsonSubTypes.Type(value = Dog::class, name = "dog")
2425
)
2526
sealed class Pet(
2627

27-
@field:com.fasterxml.jackson.annotation.JsonProperty("name")
28-
open val name: kotlin.String
29-
,
30-
3128
@field:com.fasterxml.jackson.annotation.JsonProperty("petType")
3229
open val petType: kotlin.String
3330

0 commit comments

Comments
 (0)