Skip to content

Use Test Examples as the placeholder for SwaggerUI? #930

Open
@krowvin

Description

@krowvin

When going about learning a new endpoint I find myself going between the tests, what I think something should be, and guesswork/error responses.

If possible can we start placing (or go back) and place the test examples like this one:

InputStream resource = this.getClass().getResourceAsStream("/cwms/cda/api/spk/text_ts_create_reg.json");

and its contents:
https://github.com/USACE/cwms-data-api/blob/develop/cwms-data-api/src/test/resources/cwms/cda/api/spk/text_ts_create_reg.json

That would go a long way in giving users an idea on how something might work. (Especially POST bodies)

Things I ran into just trying to run this endpoint were

  1. Realizing it should actually be a valid TSID (whoops)
  2. Making sure the time I set for it matches the interval I provided
  3. Realizing what all is actually required vs what the example provided

This way the tests also test every input as well (instead of doing the minimum)

Thought of this when trying to figure out

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussion-pointSomething to talk about but take no action yetdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions