znsio / specmatic

Turn your contracts into executable specifications. Contract Driven Development - Collaboratively Design & Independently Deploy MicroServices & MicroFrontends.
https://specmatic.io
MIT License
279 stars 52 forks source link

Specmatic uses auto-generated payload over examples specified in yaml #1301

Open dennisko762 opened 1 month ago

dennisko762 commented 1 month ago

Description

As mentioned in the title while running specmatic contract tests against java spring api, instead of using the payload examples for request and response, specmatic uses auto-generated payload with random values.

Steps to reproduce

  1. Implement a simple CRUD api in any language you prefer based on the attached yaml.
  2. run following command java -jar specmatic.jar test src/main/resources/openapi.yaml --testBaseURL=http://localhost:3000 to test your api.
  3. Observe the test payload that differes from the examples specified in the openapi.yaml file.

Expected behavior Test payload equals what I specified in the examples section of the api description in the openapi.yaml file. For the POST and GET endpoints I specified example payloads similarly as described in this article (chapter PetStore API Specification): https://specmatic.io/getting_started.html and expected my examples to be used for the test, resulting in success.

Screenshot_1 Screenshot_2

System Information:

Thanks a lot in advance and best regards

dennisko762 commented 1 month ago

Here is the openapi spec file (converted to json) openapi.json

pranavgawri commented 1 month ago

Hi, @dennisko762

Thanks for reporting the problem you are facing. We will look into this and update you ASAP.