Java Code Examples for io.swagger.v3.oas.models.media.IntegerSchema#setExample()

The following examples show how to use io.swagger.v3.oas.models.media.IntegerSchema#setExample() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExampleBuilderTest.java    From swagger-inflector with Apache License 2.0 6 votes vote down vote up
@Test
public void testIssue133() throws Exception {
    IntegerSchema integerSchema = new IntegerSchema();
    integerSchema.setFormat("int64");
    integerSchema.setExample(new Long(4321));
    Schema model = new Schema();
    model.addProperties("int64",integerSchema);
    Map<String, Schema> definitions = new HashMap<>();
    definitions.put("Address", model);

    Example rep = ExampleBuilder.fromSchema(new Schema().$ref("Address"), definitions);
    assertEqualsIgnoreLineEnding(Json.pretty(rep),
            "{\n" +
            "  \"int64\" : 4321\n" +
            "}");
}
 
Example 2
Source File: ExampleBuilderTest.java    From swagger-inflector with Apache License 2.0 6 votes vote down vote up
@Test
public void testIssue127() throws Exception {
    IntegerSchema integerProperty = new IntegerSchema();
    integerProperty.setFormat(null);
    integerProperty.setExample(new Long(4321));
    Schema model = new Schema();
    model.addProperties("unboundedInteger",integerProperty);


    Map<String, Schema> definitions = new HashMap<>();
    definitions.put("Address", model);

    Example rep = ExampleBuilder.fromSchema(new Schema().$ref("Address"), definitions);

    Json.prettyPrint(rep);
    assertEqualsIgnoreLineEnding(Json.pretty(rep),
            "{\n" +
            "  \"unboundedInteger\" : 4321\n" +
            "}");
}