use of io.swagger.v3.core.oas.models.ModelWithEnumRefProperty in project swagger-core by swagger-api.
the class EnumPropertyTest method testEnumRefProperty.
@Test(description = "it should read a model with an enum property as a reference")
public void testEnumRefProperty() {
Schema schema = context.resolve(new AnnotatedType(ModelWithEnumRefProperty.class));
final Map<String, Schema> models = context.getDefinedModels();
final String yaml = "ModelWithEnumRefProperty:\n" + " type: object\n" + " properties:\n" + " a:\n" + " $ref: '#/components/schemas/TestEnum'\n" + " b:\n" + " $ref: '#/components/schemas/TestEnum'\n" + " c:\n" + " $ref: '#/components/schemas/TestSecondEnum'\n" + " d:\n" + " type: string\n" + " enum:\n" + " - A_PRIVATE\n" + " - A_PUBLIC\n" + " - A_SYSTEM\n" + " - A_INVITE_ONLY\n" + "TestEnum:\n" + " type: string\n" + " enum:\n" + " - PRIVATE\n" + " - PUBLIC\n" + " - SYSTEM\n" + " - INVITE_ONLY\n" + "TestSecondEnum:\n" + " type: string\n" + " enum:\n" + " - A_PRIVATE\n" + " - A_PUBLIC\n" + " - A_SYSTEM\n" + " - A_INVITE_ONLY\n";
SerializationMatchers.assertEqualsToYaml(models, yaml);
}
Aggregations