Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

How to start with initialized data? #15

Open
klaygomes opened this issue Dec 21, 2015 · 1 comment
Open

How to start with initialized data? #15

klaygomes opened this issue Dec 21, 2015 · 1 comment

Comments

@klaygomes
Copy link

Is it possible to start swagger server with initialized mock data? I tried using examples property from responses in swagger but it didnt work.

 /empresas:
    get:
      description: some description
      parameters:
        - $ref: "#/parameters/empresa"
      responses:
        '200':
          schema:
            title: ArrayOfEmpresa
            type: array
            items:
              $ref: "#/definitions/empresa"
          examples:
            application/json:
              - nome: Teste 1
                id: 1
              - nome: Teste 2
                id: 2
@fcardona
Copy link

I'm not sure you can add mock data to the yaml file.

However, I've been testing this project today and noticed that on sample 3 he demonstrates a way to initialize mock data. The data is loaded from @bigstickcarpet/mock-data - which is a directory within node_modules. See line 5 of employess.js

When loadMockData is executed during initialization it saves the employees in the mock data store.

You can follow a similar pattern to add initial data.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants