USACE / cwms-data-api

Corps Water Management System RESTful Data Service
MIT License
14 stars 14 forks source link

Use Test Examples as the placeholder for SwaggerUI? #930

Open krowvin opened 1 month ago

krowvin commented 1 month ago

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: https://github.com/USACE/cwms-data-api/blob/5fd3d7e6d0ead40992bc47631916245575b4d017/cwms-data-api/src/test/java/cwms/cda/api/TextTimeSeriesControllerTestIT.java#L159 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

    • 931

MikeNeilson commented 1 month ago

I think part of the sentence just before "that would go a long way" is missing.

Are you asking those be included in the examples on Swagger? If yes, I don't dissagree, but I've had some issues with the settings the example data. Though I think for this one it should work.