Better handling of Inline schema (#15682)

* skip allOf inline subschema created as $ref

* add option for fallback

* add back atleastonemodel

* add log

* update java, kotlin, js samples

* update tests

* fix native client test

* fix java client errors by regenerating test files

* clean up python

* clean up powershell

* clean up php

* clean up ruby

* update erlang, elixir

* update dart samples

* update ts samples

* update r, go samples

* update perl

* update swift

* add back files

* add back files

* remove outdated test files

* fix test
This commit is contained in:
William Cheng
2023-06-11 15:35:58 +08:00
committed by GitHub
parent 21748e024a
commit 6788f43af0
1026 changed files with 1185 additions and 50712 deletions

View File

@@ -19,15 +19,12 @@ docs/ArrayOfArrayOfNumberOnly.md
docs/ArrayOfNumberOnly.md
docs/ArrayTest.md
docs/BigCat.md
docs/BigCatAllOf.md
docs/Capitalization.md
docs/Cat.md
docs/CatAllOf.md
docs/Category.md
docs/ClassModel.md
docs/Client.md
docs/Dog.md
docs/DogAllOf.md
docs/EnumArrays.md
docs/EnumClass.md
docs/EnumTest.md
@@ -105,15 +102,12 @@ src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java
src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java
src/main/java/org/openapitools/client/model/ArrayTest.java
src/main/java/org/openapitools/client/model/BigCat.java
src/main/java/org/openapitools/client/model/BigCatAllOf.java
src/main/java/org/openapitools/client/model/Capitalization.java
src/main/java/org/openapitools/client/model/Cat.java
src/main/java/org/openapitools/client/model/CatAllOf.java
src/main/java/org/openapitools/client/model/Category.java
src/main/java/org/openapitools/client/model/ClassModel.java
src/main/java/org/openapitools/client/model/Client.java
src/main/java/org/openapitools/client/model/Dog.java
src/main/java/org/openapitools/client/model/DogAllOf.java
src/main/java/org/openapitools/client/model/EnumArrays.java
src/main/java/org/openapitools/client/model/EnumClass.java
src/main/java/org/openapitools/client/model/EnumTest.java

View File

@@ -192,15 +192,12 @@ Class | Method | HTTP request | Description
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [ArrayTest](docs/ArrayTest.md)
- [BigCat](docs/BigCat.md)
- [BigCatAllOf](docs/BigCatAllOf.md)
- [Capitalization](docs/Capitalization.md)
- [Cat](docs/Cat.md)
- [CatAllOf](docs/CatAllOf.md)
- [Category](docs/Category.md)
- [ClassModel](docs/ClassModel.md)
- [Client](docs/Client.md)
- [Dog](docs/Dog.md)
- [DogAllOf](docs/DogAllOf.md)
- [EnumArrays](docs/EnumArrays.md)
- [EnumClass](docs/EnumClass.md)
- [EnumTest](docs/EnumTest.md)

View File

@@ -1364,15 +1364,29 @@ components:
Dog:
allOf:
- $ref: '#/components/schemas/Animal'
- $ref: '#/components/schemas/Dog_allOf'
- properties:
breed:
type: string
type: object
Cat:
allOf:
- $ref: '#/components/schemas/Animal'
- $ref: '#/components/schemas/Cat_allOf'
- properties:
declawed:
type: boolean
type: object
BigCat:
allOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/BigCat_allOf'
- properties:
kind:
enum:
- lions
- tigers
- leopards
- jaguars
type: string
type: object
Animal:
discriminator:
propertyName: className
@@ -2165,29 +2179,6 @@ components:
required:
- requiredFile
type: object
Dog_allOf:
properties:
breed:
type: string
type: object
example: null
Cat_allOf:
properties:
declawed:
type: boolean
type: object
example: null
BigCat_allOf:
properties:
kind:
enum:
- lions
- tigers
- leopards
- jaguars
type: string
type: object
example: null
securitySchemes:
petstore_auth:
flows:

View File

@@ -1,24 +0,0 @@
# BigCatAllOf
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**kind** | [**KindEnum**](#KindEnum) | | [optional] |
## Enum: KindEnum
| Name | Value |
|---- | -----|
| LIONS | "lions" |
| TIGERS | "tigers" |
| LEOPARDS | "leopards" |
| JAGUARS | "jaguars" |

View File

@@ -1,13 +0,0 @@
# CatAllOf
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**declawed** | **Boolean** | | [optional] |

View File

@@ -1,13 +0,0 @@
# DogAllOf
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**breed** | **String** | | [optional] |

View File

@@ -1,149 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.JSON;
/**
* BigCatAllOf
*/
@JsonPropertyOrder({
BigCatAllOf.JSON_PROPERTY_KIND
})
@JsonTypeName("BigCat_allOf")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class BigCatAllOf {
/**
* Gets or Sets kind
*/
public enum KindEnum {
LIONS("lions"),
TIGERS("tigers"),
LEOPARDS("leopards"),
JAGUARS("jaguars");
private String value;
KindEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static KindEnum fromValue(String value) {
for (KindEnum b : KindEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
public static final String JSON_PROPERTY_KIND = "kind";
private KindEnum kind;
public BigCatAllOf() {
}
public BigCatAllOf kind(KindEnum kind) {
this.kind = kind;
return this;
}
/**
* Get kind
* @return kind
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_KIND)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public KindEnum getKind() {
return kind;
}
@JsonProperty(JSON_PROPERTY_KIND)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setKind(KindEnum kind) {
this.kind = kind;
}
/**
* Return true if this BigCat_allOf object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BigCatAllOf bigCatAllOf = (BigCatAllOf) o;
return Objects.equals(this.kind, bigCatAllOf.kind);
}
@Override
public int hashCode() {
return Objects.hash(kind);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BigCatAllOf {\n");
sb.append(" kind: ").append(toIndentedString(kind)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -1,110 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.JSON;
/**
* CatAllOf
*/
@JsonPropertyOrder({
CatAllOf.JSON_PROPERTY_DECLAWED
})
@JsonTypeName("Cat_allOf")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class CatAllOf {
public static final String JSON_PROPERTY_DECLAWED = "declawed";
private Boolean declawed;
public CatAllOf() {
}
public CatAllOf declawed(Boolean declawed) {
this.declawed = declawed;
return this;
}
/**
* Get declawed
* @return declawed
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_DECLAWED)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getDeclawed() {
return declawed;
}
@JsonProperty(JSON_PROPERTY_DECLAWED)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setDeclawed(Boolean declawed) {
this.declawed = declawed;
}
/**
* Return true if this Cat_allOf object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CatAllOf catAllOf = (CatAllOf) o;
return Objects.equals(this.declawed, catAllOf.declawed);
}
@Override
public int hashCode() {
return Objects.hash(declawed);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CatAllOf {\n");
sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -1,110 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.JSON;
/**
* DogAllOf
*/
@JsonPropertyOrder({
DogAllOf.JSON_PROPERTY_BREED
})
@JsonTypeName("Dog_allOf")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class DogAllOf {
public static final String JSON_PROPERTY_BREED = "breed";
private String breed;
public DogAllOf() {
}
public DogAllOf breed(String breed) {
this.breed = breed;
return this;
}
/**
* Get breed
* @return breed
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_BREED)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getBreed() {
return breed;
}
@JsonProperty(JSON_PROPERTY_BREED)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setBreed(String breed) {
this.breed = breed;
}
/**
* Return true if this Dog_allOf object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DogAllOf dogAllOf = (DogAllOf) o;
return Objects.equals(this.breed, dogAllOf.breed);
}
@Override
public int hashCode() {
return Objects.hash(breed);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DogAllOf {\n");
sb.append(" breed: ").append(toIndentedString(breed)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -1,48 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* Model tests for BigCatAllOf
*/
public class BigCatAllOfTest {
private final BigCatAllOf model = new BigCatAllOf();
/**
* Model tests for BigCatAllOf
*/
@Test
public void testBigCatAllOf() {
// TODO: test BigCatAllOf
}
/**
* Test the property 'kind'
*/
@Test
public void kindTest() {
// TODO: test kind
}
}

View File

@@ -1,48 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* Model tests for CatAllOf
*/
public class CatAllOfTest {
private final CatAllOf model = new CatAllOf();
/**
* Model tests for CatAllOf
*/
@Test
public void testCatAllOf() {
// TODO: test CatAllOf
}
/**
* Test the property 'declawed'
*/
@Test
public void declawedTest() {
// TODO: test declawed
}
}

View File

@@ -1,48 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* Model tests for DogAllOf
*/
public class DogAllOfTest {
private final DogAllOf model = new DogAllOf();
/**
* Model tests for DogAllOf
*/
@Test
public void testDogAllOf() {
// TODO: test DogAllOf
}
/**
* Test the property 'breed'
*/
@Test
public void breedTest() {
// TODO: test breed
}
}