vrata icon indicating copy to clipboard operation
vrata copied to clipboard

Example with a simple microservice

Open alejogutierrez opened this issue 8 years ago • 23 comments

Hi I was looking to the implementation but still don't know how to interact with a service. It is possible to see an example with a simple service? Also a license would be awesome, thanks

alejogutierrez avatar Feb 02 '17 02:02 alejogutierrez

I've just added a license - thanks for noticing this! :)

Sure, we can provide an example. Does your simple microservice have Swagger documentation?

dusterio avatar Feb 02 '17 03:02 dusterio

Well not really, in fact I found your repo because right now I'm moving from a monolitic Laravel app to microsevices written in Lumen. So does it mean that you have to use an specific modeling lang like swagger o RAML? Thanks again

alejogutierrez avatar Feb 02 '17 03:02 alejogutierrez

You can either do it manually by providing your API gateway routes in GATEWAY_ROUTES environment variable, or you could parse Swagger JSON automatically. Swagger is just a nice way

dusterio avatar Feb 02 '17 03:02 dusterio

Fine I'm going to take a look using swagger.

alejogutierrez avatar Feb 02 '17 03:02 alejogutierrez

I agree that it would be awesome to have some configuration examples (in my case swagger based microservice, but any further hint would be really appreciated) Thanks!.

reindeer77 avatar Feb 08 '17 10:02 reindeer77

Sure, you are right. Will add some examples tomorrow!

dusterio avatar Feb 08 '17 11:02 dusterio

@dusterio Hi Dusterio, where you able to add examples? The doc really does not make sense. I'm pretty sure that no one can run the full example, especially Swagger parts. It would be nice to have working examples with Swagger support.

moon0326 avatar Jun 09 '17 00:06 moon0326

@moon0326 I did but perhaps it wasn't enough :) I will review the documentation today and make sure it's comprehensive!

dusterio avatar Jun 09 '17 01:06 dusterio

@dusterio Thank you so much!

moon0326 avatar Jun 09 '17 07:06 moon0326

@moon0326 Have you managed to use swagger with the api gateway. I don't get how this works. Any help will be appreciated. What does the routes.json file do?

spacecomx avatar Jun 20 '17 12:06 spacecomx

@spacecomx your microservices are expected to expose Swagger documentation endpoints (version 1), all actions will be imported upon start. routes.json is an internal, auto-generated file - a result of parsing of those Swagger endpoints.

dusterio avatar Jun 20 '17 12:06 dusterio

@dusterio Thats where I'm hitting a stone wall. The gateway set config file provided with the package endpoint are local? I get an error no "apis" with petstore for example? It that related to swagger version. I did drop you an email yesterday, please can you check it out. Thanks :)

spacecomx avatar Jun 20 '17 12:06 spacecomx

@spacecomx I've just checked and Petstore is only provided in Swagger v2, it didn't exist till v2 I suppose. I guess it's time to add Swagger v2 support to Vrata.

The reason I stuck with v1 only originally is - all major frameworks I checked at that time (~6 months ago) only had packages for v1.

dusterio avatar Jun 20 '17 12:06 dusterio

@dusterio Oh you a Star. When creating apis with swagger it defaults to v2.0. Trying to change it to v1 runs an error in the UI. I saw you mentioned v1.0 in your docs, but did not expect that to be an issue at the time. Any time frame on the support for v2? Thanks for the quick responses, wow!

spacecomx avatar Jun 20 '17 13:06 spacecomx

@spacecomx I'll check tomorrow! if it's something simple (the difference is not too big) - I will add a v2 parser tomorrow :)

dusterio avatar Jun 20 '17 13:06 dusterio

Thank your attention and addressing enquiries so quickly. Please can you include an example the petstore setup in the gateway config or docs. Most will look at swagger docs and reference the petstore api to understand the workflow. Look forward to the update to v2.

spacecomx avatar Jun 20 '17 13:06 spacecomx

@dusterio Just a side note. Swagger 3.0 is planned to be released by the end of July. The name will be changing to OpenAPI, but the tooling will continue to have the Swagger name.

spacecomx avatar Jun 21 '17 18:06 spacecomx

@dusterio Do you have any feedback on the swagger v2.0 requirements. I was hoping to get the gateway up an running the weekend. If not ready, is there anyway to manually set the api endpoints without swagger so I can get up an running. I have two services that must be pushed into the gateway. Please help, thank you.

spacecomx avatar Jun 24 '17 09:06 spacecomx

where we will define routes mapping in this project?

rizwanmcs avatar May 24 '18 20:05 rizwanmcs

@dusterio Hi, where you able to add examples? :(

harunnryd avatar May 28 '18 04:05 harunnryd

no example with swagger :(

agungsugiarto avatar Dec 27 '19 13:12 agungsugiarto

Thank you so much for this awesome gateway.  I am trying to use this one however I have a couple questions about swagger. Until I know there are two ways to generate documentation for an API using swagger.

1 - Using the public swagger editor: https://swagger.io/. It  generates API documentation and lets you share and collaborate  with people. I am able to export my documentation but I do not know how to use  the exported  documentation ( swagger.json ) to discover it. through the gateway.  I think I need to create a controller, route ,etc.

2 - Using some composer packages that generates that documentation. To generate the documentation , basically you need to use the swagger notation in each controller and function. The package exposes your documentation so the gateway can discover the service.

Based on your experience, what is the best approach to document an API.  If you use some composer package for lumen,  Could you share the name please.

Thank you

eddycastillon avatar Aug 18 '20 15:08 eddycastillon

@eddycastillon you can use my api gateway bro :) https://github.com/harunnryd/gateid

harunnryd avatar Aug 18 '20 21:08 harunnryd