Skip to content

Instantly share code, notes, and snippets.

@msavy
Last active July 26, 2018 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msavy/19c66f8dc78ee90d7e31973efb7ad12b to your computer and use it in GitHub Desktop.
Save msavy/19c66f8dc78ee90d7e31973efb7ad12b to your computer and use it in GitHub Desktop.
{
"components" : {
"schemas" : {
"test.io.smallrye.openapi.runtime.scanner.entities.KitchenSink" : {
"description" : "This is the kitchen sink description!",
"required" : [ "booking", "ccList", "creditCardMap", "fooArray", "fuzzListWildcard", "seatPreference", "unsafeList" ],
"properties" : {
"array" : {
"type" : "array",
"items" : {
"format" : "int32",
"type" : "integer"
}
},
"awkwardMap" : {
"type" : "object",
"additionalProperties" : {
"type" : "string"
}
},
"awkwardMap2" : {
"type" : "object",
"additionalProperties" : {
"type" : "object",
"properties" : {
"z" : {
"format" : "int32",
"type" : "integer"
}
}
}
},
"barExtends" : {
"type" : "array",
"items" : {
"type" : "object",
"properties" : {
"theQ" : {
"type" : "object"
},
"theT" : {
"type" : "object",
"properties" : {
"an_integer_value" : {
"format" : "int32",
"type" : "integer"
}
}
},
"ultimateTShouldBeQ" : {
"type" : "object"
}
}
}
},
"barSuper" : {
"type" : "array",
"items" : {
"type" : "object"
}
},
"bareCollection" : {
"type" : "array"
},
"bareEnum" : {
"type" : "array",
"items" : {
"type" : "object"
}
},
"blahMap" : {
"type" : "object",
"additionalProperties" : {
"type" : "object"
}
},
"booking" : {
"required" : [ "airMiles", "creditCard", "departtureFlight", "returningFlight", "seatPreference" ],
"type" : "object",
"properties" : {
"airMiles" : {
"type" : "string",
"example" : "32126319"
},
"creditCard" : {
"required" : [ "cardNumber", "cardholderName", "cvv", "expiryDate", "issuer" ],
"type" : "object",
"properties" : {
"cardNumber" : {
"type" : "string",
"example" : "**********1234"
},
"cardholderName" : {
"type" : "string",
"example" : "Joe Smith"
},
"cvv" : {
"type" : "string",
"example" : "0322"
},
"expiryDate" : {
"type" : "string",
"example" : "04/19"
},
"issuer" : {
"type" : "string",
"example" : "VISA"
}
}
},
"departtureFlight" : {
"required" : [ "airline", "airportFrom", "airportTo", "dateTime", "number", "price", "status" ],
"type" : "object",
"properties" : {
"airline" : {
"required" : [ "contactPhone", "name" ],
"type" : "object",
"properties" : {
"contactPhone" : {
"type" : "string",
"example" : "1-888-1234-567"
},
"name" : {
"type" : "string",
"example" : "Acme Air"
}
}
},
"airportFrom" : {
"type" : "string",
"example" : "YYZ"
},
"airportTo" : {
"type" : "string",
"example" : "LAX"
},
"dateTime" : {
"pattern" : "dateTime",
"type" : "string",
"example" : "2016-03-05 18:00"
},
"number" : {
"type" : "string",
"example" : "AC190"
},
"price" : {
"type" : "string",
"example" : "US$350"
},
"status" : {
"type" : "string",
"example" : "On Schedule"
}
}
},
"returningFlight" : {
"required" : [ "airline", "airportFrom", "airportTo", "dateTime", "number", "price", "status" ],
"type" : "object",
"properties" : {
"airline" : {
"required" : [ "contactPhone", "name" ],
"type" : "object",
"properties" : {
"contactPhone" : {
"type" : "string",
"example" : "1-888-1234-567"
},
"name" : {
"type" : "string",
"example" : "Acme Air"
}
}
},
"airportFrom" : {
"type" : "string",
"example" : "YYZ"
},
"airportTo" : {
"type" : "string",
"example" : "LAX"
},
"dateTime" : {
"pattern" : "dateTime",
"type" : "string",
"example" : "2016-03-05 18:00"
},
"number" : {
"type" : "string",
"example" : "AC190"
},
"price" : {
"type" : "string",
"example" : "US$350"
},
"status" : {
"type" : "string",
"example" : "On Schedule"
}
}
},
"seatPreference" : {
"type" : "string",
"example" : "window"
}
}
},
"ccList" : {
"type" : "array",
"items" : {
"required" : [ "cardNumber", "cardholderName", "cvv", "expiryDate", "issuer" ],
"type" : "object",
"properties" : {
"cardNumber" : {
"type" : "string",
"example" : "**********1234"
},
"cardholderName" : {
"type" : "string",
"example" : "Joe Smith"
},
"cvv" : {
"type" : "string",
"example" : "0322"
},
"expiryDate" : {
"type" : "string",
"example" : "04/19"
},
"issuer" : {
"type" : "string",
"example" : "VISA"
}
}
}
},
"complexNesting" : {
"type" : "object",
"properties" : {
"qAgain" : {
"format" : "double",
"type" : "number"
},
"qAgain3" : {
"format" : "double",
"type" : "number"
},
"qValue" : {
"format" : "double",
"description" : "Ah, Q, my favourite variable!",
"type" : "number"
},
"tAgain2" : {
"required" : [ "bar", "foo" ],
"type" : "object",
"properties" : {
"bar" : {
"format" : "int32",
"type" : "integer"
},
"foo" : {
"maxLength" : 123456,
"type" : "object",
"properties" : {
"qAgain" : {
"type" : "object"
},
"qAgain3" : {
"type" : "object"
},
"qValue" : {
"description" : "Ah, Q, my favourite variable!",
"type" : "object"
},
"tAgain2" : {
"type" : "string"
},
"tAgain4" : {
"type" : "string"
},
"tValue" : {
"type" : "string"
}
}
}
}
},
"tAgain4" : {
"required" : [ "bar", "foo" ],
"type" : "object",
"properties" : {
"bar" : {
"format" : "int32",
"type" : "integer"
},
"foo" : {
"maxLength" : 123456,
"type" : "object",
"properties" : {
"qAgain" : {
"type" : "object"
},
"qAgain3" : {
"type" : "object"
},
"qValue" : {
"description" : "Ah, Q, my favourite variable!",
"type" : "object"
},
"tAgain2" : {
"type" : "string"
},
"tAgain4" : {
"type" : "string"
},
"tValue" : {
"type" : "string"
}
}
}
}
},
"tValue" : {
"required" : [ "bar", "foo" ],
"type" : "object",
"properties" : {
"bar" : {
"format" : "int32",
"type" : "integer"
},
"foo" : {
"maxLength" : 123456,
"type" : "object",
"properties" : {
"qAgain" : {
"type" : "object"
},
"qAgain3" : {
"type" : "object"
},
"qValue" : {
"description" : "Ah, Q, my favourite variable!",
"type" : "object"
},
"tAgain2" : {
"type" : "string"
},
"tAgain4" : {
"type" : "string"
},
"tValue" : {
"type" : "string"
}
}
}
}
}
}
},
"creditCardMap" : {
"type" : "object",
"additionalProperties" : {
"required" : [ "cardNumber", "cardholderName", "cvv", "expiryDate", "issuer" ],
"type" : "object",
"properties" : {
"cardNumber" : {
"type" : "string",
"example" : "**********1234"
},
"cardholderName" : {
"type" : "string",
"example" : "Joe Smith"
},
"cvv" : {
"type" : "string",
"example" : "0322"
},
"expiryDate" : {
"type" : "string",
"example" : "04/19"
},
"issuer" : {
"type" : "string",
"example" : "VISA"
}
}
}
},
"customTypeExtendsSuper" : {
"required" : [ "bar", "foo" ],
"type" : "object",
"properties" : {
"bar" : {
"type" : "object"
},
"foo" : {
"maxLength" : 123456,
"type" : "string"
}
}
},
"foo" : {
"type" : "object",
"properties" : {
"theQ" : {
"type" : "string"
},
"theT" : {
"type" : "object",
"properties" : {
"hellofrombazzy" : {
"type" : "string"
},
"an_integer_value" : {
"format" : "int32",
"type" : "integer"
}
}
},
"ultimateTShouldBeQ" : {
"type" : "string"
}
}
},
"fooArray" : {
"type" : "array",
"items" : {
"type" : "object",
"properties" : {
"theQ" : {
"type" : "object"
},
"theT" : {
"type" : "object",
"properties" : {
"an_integer_value" : {
"format" : "int32",
"type" : "integer"
}
}
},
"ultimateTShouldBeQ" : {
"type" : "object"
}
}
}
},
"fuzzListWildcard" : {
"type" : "object",
"properties" : {
"qAgain" : {
"type" : "object",
"properties" : {
"theQ" : {
"type" : "string"
},
"theT" : {
"type" : "object",
"properties" : {
"hellofrombazzy" : {
"type" : "string"
},
"an_integer_value" : {
"format" : "int32",
"type" : "integer"
}
}
},
"ultimateTShouldBeQ" : {
"type" : "string"
}
}
},
"qAgain3" : {
"type" : "object",
"properties" : {
"theQ" : {
"type" : "string"
},
"theT" : {
"type" : "object",
"properties" : {
"hellofrombazzy" : {
"type" : "string"
},
"an_integer_value" : {
"format" : "int32",
"type" : "integer"
}
}
},
"ultimateTShouldBeQ" : {
"type" : "string"
}
}
},
"qValue" : {
"description" : "Ah, Q, my favourite variable!",
"type" : "object",
"properties" : {
"theQ" : {
"type" : "string"
},
"theT" : {
"type" : "object",
"properties" : {
"hellofrombazzy" : {
"type" : "string"
},
"an_integer_value" : {
"format" : "int32",
"type" : "integer"
}
}
},
"ultimateTShouldBeQ" : {
"type" : "string"
}
}
},
"tAgain2" : {
"type" : "string"
},
"tAgain4" : {
"type" : "string"
},
"tValue" : {
"type" : "string"
}
}
},
"longArray" : {
"type" : "array",
"items" : {
"format" : "int64",
"type" : "integer"
}
},
"nesting" : {
"required" : [ "bar", "foo" ],
"type" : "object",
"properties" : {
"bar" : {
"format" : "int32",
"type" : "integer"
},
"foo" : {
"maxLength" : 123456,
"required" : [ "bar", "foo" ],
"type" : "object",
"properties" : {
"bar" : {
"type" : "string"
},
"foo" : {
"maxLength" : 123456,
"type" : "string"
}
}
}
}
},
"password" : {
"type" : "string"
},
"primitiveFoo" : {
"format" : "int32",
"maximum" : 9001,
"type" : "integer"
},
"rawArray" : {
"type" : "array",
"items" : {
"type" : "object"
}
},
"rootNode" : {
"type" : "object",
"properties" : {
"next" : {
"description" : "Cyclic reference to test.io.smallrye.openapi.runtime.scanner.entities.BuzzLinkedList",
"type" : "object"
}
}
},
"seatPreference" : {
"maxLength" : 999,
"type" : "string",
"example" : "window"
},
"simpleParameterizedType" : {
"required" : [ "bar", "foo" ],
"type" : "object",
"properties" : {
"bar" : {
"format" : "int32",
"type" : "integer"
},
"foo" : {
"maxLength" : 123456,
"type" : "string"
}
}
},
"unsafeList" : {
"type" : "array"
},
"voidField" : {
"type" : "object"
},
"writeOnlyInteger" : {
"format" : "int32",
"type" : "integer",
"writeOnly" : true
}
},
"example" : "This is the KitchenSink example field in Schema",
"deprecated" : true
}
}
}
}
{
"components" : {
"schemas" : {
"KustomPair" : {
"required" : [ "bar", "foo" ],
"properties" : {
"bar" : {
"format" : "int32",
"type" : "integer"
},
"foo" : {
"maxLength" : 123456,
"type" : "string"
}
}
}
}
}
}
@Schema(description = "This is the kitchen sink description!",
example = "This is the KitchenSink example field in Schema",
deprecated = true)
@SuppressWarnings({"unused", "rawtypes"})
public class KitchenSink {
// Arrays
Enum[] bareEnum;
int[] array;
@Schema(maximum = "9001")
int primitiveFoo;
// TODO
//int[][] array2d;
// Handle arrays
@Schema(required = true)
Bar[] fooArray = new Bar[2];
TimerTask[] rawArray = new TimerTask[2];
Long[] longArray = {1L, 2L};
// Generic list with super
List<? super Flight> barSuper;
// Generic list with extends
List<? extends Bar> barExtends;
// Bare collection
Collection bareCollection;
// Bare list
@Schema(required = true)
List unsafeList;
// Maps
@Schema(required = true)
Map<String, CreditCard> creditCardMap = new LinkedHashMap<>();
Map<? extends Foo, ? super Foo> blahMap;
Map<Integer, StringBuffer> awkwardMap;
Map<Integer, BazEnum> awkwardMap2;
// OAI TCK fields
@Schema(required = true)
Booking booking;
@Schema(required = true, example = "window", maxLength = 999)
String seatPreference;
@Schema(writeOnly = true)
Integer writeOnlyInteger = 5;
@Schema(required = true)
List<CreditCard> ccList;
// Simple generic typed pair to test handling of pType
KustomPair<String, Integer> simpleParameterizedType;
// Nesting generic types with same type.
KustomPair<KustomPair<String, String>, Integer> nesting;
// Complex nesting of generics including unbounded wildcard
Fuzz<KustomPair<Fuzz<String, ?>, Integer>, Double> complexNesting;
// Handle ? with extends bound
@Schema(required = true)
Fuzz<String, ? extends Foo> fuzzListWildcard;
// Extends and super bounds.
KustomPair<? extends String, ? super String> customTypeExtendsSuper;
// Complex generics + inheritance
Foo foo;
// Cycles
BuzzLinkedList rootNode;
// Handle Void
Void voidField = null;
// With format and
@Schema(type = SchemaType.STRING, format="password")
String password = "hunter1";
public KitchenSink(){
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment