S
S
Shulginqa2019-01-04 15:53:04
PHP
Shulginqa, 2019-01-04 15:53:04

How to connect swagger client correctly?

There is a training project on api. Purpose: according to the documentation in swagger, write a ready-made handler for http requests and api of the service itself. Swagger client generated in php, but I can't figure out how to "cook" it further. That is, I need to write a handler for incoming information from a request, but the problem is in the next step. Where to dig? Don't throw your shoes too hard.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Michael, 2019-01-11
@Shulginqa

Somehow I don't quite understand, but I'll try to guess.
You have a schema and want to make an api on your server based on it. Ok, for this you can generate an api server and use it.
On the contrary, if you have a schema of some service and you want to use its api, then you can generate an api client for the schema and use it.
All this can be done at https://swagger.io/tools/swagger-codegen/
You can also generate it locally, everything is described in the documentation https://github.com/swagger-api/swagger-codegen

U
unchase, 2019-06-06
@unchase

You can use the Unchase OpenAPI (Swagger) Connected Service extension for Visual Studio 2017/2019 to automatically generate C# or TypeScript code for the client, and C# controller code for the server from the specification file.
In fact, after generating the controller code, you can fill them with the functionality you need, and then call the controller methods from the generated client.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question