Interesting in development
swagger_fixtures: test fixtures from Swagger
Generates JSON test fixtures straight from a Swagger or OpenAPI spec, so Dart models are checked against the responses the backend documents.

Testing how API responses are parsed works best with realistic examples, but writing JSON by hand takes time and it goes stale quickly. When the backend changes a response, hand-written fixtures do not know about it, and the bug only shows up in the app.
swagger_fixtures reads one or more specs by URL or local path and writes a separate JSON file for every documented response, every status code included. Bodies are built from the spec's example values, and a generated Fixtures class gives typed access to each file. Rerunning it refreshes the fixtures and removes responses that are gone from the spec.
The package is useful for Dart and Flutter teams whose backend is described in Swagger or OpenAPI. Regenerate the fixtures after an API change, and the tests show whether the models still fit the new responses.
Open on pub.dev
