Skip to content

Conversation

@bherbst
Copy link
Contributor

@bherbst bherbst commented May 21, 2020

This PR adds support for simple string examples on string properties.
This is currently possible via @WithExample, but that approach requires creating an ExampleProvider for each property that returns the example string.

Sample code:

@Response("A Response for header param example")
data class NameGreetingResponse(
    @StringExample("Hello John") val str: String
)

Generated JSON:

      "NameGreetingResponse" : {
        "nullable" : false,
        "properties" : {
          "str" : {
            "example" : "Hi, John!",
            "nullable" : false,
            "type" : "string"
          }
        },
        "required" : [ "str" ],
        "type" : "object"
      },

Swagger UI:
Screen Shot 2020-05-21 at 1 40 54 PM

@Wicpar Wicpar merged commit 10f49e3 into papsign:master May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants