Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock data for definitions? #60

Open
IoannisPetridis opened this issue Mar 12, 2020 · 1 comment
Open

Mock data for definitions? #60

IoannisPetridis opened this issue Mar 12, 2020 · 1 comment

Comments

@IoannisPetridis
Copy link

This is more of a question than an issue really.
Let's say I have the following model defined in the definitions of my swagger.json file (among others):

"definitions": {
    "Rate": {
      "type": "object",
      "properties": {
        "fromId": {
          "type": "string"
        },
        "toId": {
          "type": "string"
        },
        "rate": {
          "type": "string"
        },
        "roundedRate": {
          "type": "string"
        },
        "hint": {
          "type": "string"
        }
      },
      "required": [
        "fromId",
        "toId",
        "rate"
      ]
    },
...
}

Is it possible to generate mock data for the definitions as well and not just for parameters, responses or requests as per your documentation? For example would it be able to generate the following for the "Rate" model above in some way:

{
'fromId': 'EUR',
'toId': 'USD',
'rate': '1.12'
'roundedRate': '1.10',
'hint': 'hint hint hint'
}
@lubbo
Copy link

lubbo commented May 19, 2022

Maybe using x-example and x-examples OpenApi feature?

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

No branches or pull requests

2 participants