T
T
topuserman2021-03-03 21:35:37
Specifications
topuserman, 2021-03-03 21:35:37

SWAGGER: what is the spec for the rest api?

I need to develop rest api for one system.
Experience of development using specifications - no.
I would like to understand this when solving the current problem.
I will use swagger as a tool for describing the specification.

The following questions arose:

1. In what order is it customary to describe the specifications and develop the server / client for api ? First of all, the specification is written, then api ?

2. How does the specification directly affect the functionality of the server/client for api (besides describing it)?
Those. if the specification describes that when adding data, the data type "number" is required, and the client sends a "string", then the server must return an error ?
The essence of the question is that everything must comply with the specification 1v1? If so, is it somehow programmatically controlled (using tests)? - maybe there are some tools for this?

3. Swagger has tools for generating a client and a server according to the described specification.
How often is it used, and is it customary to use it? What are the pros and cons? And what are the approaches?

Please share your experience, any information would be helpful.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2021-03-04
@topuserman

1. Either the spec is developed first, and then the API is written. This is if you already have a detailed TK ready.
Either the API is written and in parallel (or after) it is documented. Ideally, the first option. I had to work only on the second.
2. This is just documentation. How strictly you will validate the data is up to you. Testing is also your business, and by other software tools.
3. As far as I know, no. Yes, I don't know what you mean. Press the button and get the finished product? On what YAP? On what framework? Somehow fantastic. Unlikely. Take some frame and saw yourself.
Swagger is generally the most primitive product for documenting APIs. All it does is read the file in OpenAPI format and display its contents in a readable format. Well, it can also perform requests to the API for checks. And that's it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question