use of io.swagger.v3.core.converter.AnnotatedType in project swagger-core by swagger-api.
the class Ticket2915Test method testPropertyName.
@Test
public void testPropertyName() throws Exception {
final ModelResolver modelResolver = new ModelResolver(mapper());
final ModelConverterContextImpl context = new ModelConverterContextImpl(modelResolver);
final Schema model = context.resolve(new AnnotatedType(TestObject2915.class));
SerializationMatchers.assertEqualsToYaml(context.getDefinedModels(), "QuantitativeValue:\n" + " required:\n" + " - value\n" + " type: object\n" + " properties:\n" + " value:\n" + " type: number\n" + " format: double\n" + " unitText:\n" + " type: string\n" + " unitCode:\n" + " type: string\n" + " description: A combination of a value and associated unit\n" + "TestObject2616:\n" + " type: object\n" + " properties:\n" + " name:\n" + " type: string\n" + " perServing:\n" + " $ref: '#/components/schemas/QuantitativeValue'\n" + " per100Gram:\n" + " $ref: '#/components/schemas/QuantitativeValue'\n" + " description: Nutritional value specification");
}
use of io.swagger.v3.core.converter.AnnotatedType in project swagger-core by swagger-api.
the class Ticket2740CyclicTest method testCyclicBean.
@Test
public void testCyclicBean() throws Exception {
final ModelResolver modelResolver = new ModelResolver(mapper());
final ModelConverterContextImpl context = new ModelConverterContextImpl(modelResolver);
final Schema model = context.resolve(new AnnotatedType(MyThing.class));
SerializationMatchers.assertEqualsToYaml(model, "type: object\n" + "properties:\n" + " otherThings:\n" + " uniqueItems: true\n" + " type: array\n" + " description: Other related things\n" + " items:\n" + " $ref: '#/components/schemas/MyThing'\n" + "description: Thing");
}
use of io.swagger.v3.core.converter.AnnotatedType in project swagger-core by swagger-api.
the class Ticket2884Test method test2884.
@Test
public void test2884() throws Exception {
final ModelResolver modelResolver = new ModelResolver(mapper());
ModelConverterContextImpl context = new ModelConverterContextImpl(modelResolver);
Ticket2884ModelClass a = new Ticket2884ModelClass();
Schema model = context.resolve(new AnnotatedType(Ticket2884Model.class));
SerializationMatchers.assertEqualsToYaml(context.getDefinedModels(), "Ticket2884Model:\n" + " type: object\n" + " properties:\n" + " Ticket2884Model:\n" + " type: object");
context = new ModelConverterContextImpl(modelResolver);
model = context.resolve(new AnnotatedType(Ticket2884ModelClass.class));
SerializationMatchers.assertEqualsToYaml(context.getDefinedModels(), "Ticket2884ModelClass:\n" + " type: object\n" + " properties:\n" + " Ticket2884ModelClass:\n" + " type: object\n" + " properties:\n" + " bar:\n" + " type: string\n" + " foo:\n" + " type: array\n" + " items:\n" + " type: string\n");
}
use of io.swagger.v3.core.converter.AnnotatedType in project swagger-core by swagger-api.
the class Ticket3063Test method testTicket3063.
@Test
public void testTicket3063() throws Exception {
final Schema model = context.resolve(new AnnotatedType(BaseClass.class));
assertNotNull(model);
String yaml = "BaseClass:\n" + " required:\n" + " - type\n" + " type: object\n" + " properties:\n" + " type:\n" + " type: string\n" + " description: Type\n" + " example: AndroidDeviceRequirements\n" + " description: test\n" + " discriminator:\n" + " propertyName: type\n" + "SubClass:\n" + " required:\n" + " - type\n" + " type: object\n" + " description: SubClass\n" + " allOf:\n" + " - $ref: '#/components/schemas/BaseClass'\n" + " - type: object\n" + " properties:\n" + " additionalPropertyWhichShouldBeThere:\n" + " type: integer\n" + " description: Test\n" + " format: int32";
SerializationMatchers.assertEqualsToYaml(context.getDefinedModels(), yaml);
}
use of io.swagger.v3.core.converter.AnnotatedType in project swagger-core by swagger-api.
the class Ticket3348Test method testTicket3348.
@Test
public void testTicket3348() {
final Schema model = context.resolve(new AnnotatedType(WithObjects.class));
assertNotNull(model);
final Map<String, Schema> props = model.getProperties();
assertEquals(props.size(), 2);
}
Aggregations