Agreed, Good suggestion. I'm developing this plugin for a
project requirement, hope we can integrate this feature to the dashboard
after its completion.
The following is the flow I have in mind:

Step 1
Process the Open API specs and obtain the paths and corresponding HTTPS
methods (Eg: /customer/{id}, GET)
Step 2
Get all the routes existing routes in the Admin API and get route IDs which
are not being used
Step 3
Make a batch request for creating the routes for the Open API specs

The following will be the function and parameters to create the route
*POST - createRoute*

*params*


   - Upstream URL (If not specified in the Open API specs)
   - Prefix path (If the user wants to append a prefix path to the route)
   - Plugin configurations (Eg - Add jwt plugin to all the routes created
   via Open API)

The update and delete functions will update and delete the routes created
via the Open API specs accordingly.
I hope this is okay? I will post the development results in this thread.

On Thu, May 14, 2020 at 3:49 PM 88786...@qq.com <88786...@qq.com> wrote:

> That's a good idea.
>
>
>
> 88786...@qq.com
>
> From: Zhiyuan Ju
> Date: 2020-05-14 17:37
> To: dev
> Subject: Re: Support to import Open API specs to automatically create
> routes in APISIX [Discuss]
> Agree.
>
> APISIX should be as simple as possible, and because Swagger has fixed
> formats, so we could use js to parse the yml file, and then do a batch
> create to APISIX.
>
> Ming Wen <wenm...@apache.org>于2020年5月14日 周四下午5:35写道:
>
> > I think it may be more suitable as a separate tool, and it will be more
> > flexible.
> > How about add this parser tool in dashhaord?
> >
> > Thanks,
> > Ming Wen, Apache APISIX & Apache SkyWalking
> > Twitter: _WenMing
> >
> >
> > Nirojan Selvanathan <sshn...@gmail.com> 于2020年5月12日周二 下午5:13写道:
> >
> > > Hi All,
> > >
> > > Many use Open API specification to define the APIs. It would be nice if
> > we
> > > can support the feature
> > > to import the API specification and to automatically create routes
> based
> > on
> > > the specification. In case if we support this how can we implement
> this?
> > >
> > > - Feature as part of the Admin API? An upload Open API spec endpoint?
> > > - A separate script (probably python ?) to parse the swagger spec and
> > > create routes?
> > >
> > > Also, I assume we need to provide support for a route prefix when
> > importing
> > > the swagger specs.
> > > Would like to know your thoughts on this.
> > > --
> > > Best Regards,
> > > S.Nirojan
> > > Linked-in <https://www.linkedin.com/in/niroselva/>
> > >
> >
> --
> 来自 琚致远
>


-- 
Best Regards,
S.Nirojan
Linked-in <https://www.linkedin.com/in/niroselva/>

Reply via email to