You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apisix.apache.org by Nirojan Selvanathan <ss...@gmail.com> on 2020/05/12 09:13:21 UTC

Support to import Open API specs to automatically create routes in APISIX [Discuss]

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/>

Re: Re: Support to import Open API specs to automatically create routes in APISIX [Discuss]

Posted by Zhiyuan Ju <ju...@apache.org>.
Love that package! Please let me know whenever you need help!

Nirojan Selvanathan <ss...@gmail.com>于2020年6月12日 周五上午2:27写道:

> Yes, the idea is to support Open API v3. Also, I agree with the dashboard
> integration option. Therefore, developing this feature as a Node JS
> package.
>
> On Thu, 11 Jun 2020, 18:43 hui li, <yo...@apache.org> wrote:
>
> > I have a question, do you mean by open API here Open api v3 or Swagger?
> >
> > On the other hand, I also think it is more appropriate to support open
> api
> > conversion at the dashboard or api management level.
> >
> > Thanks
> >
> > Nirojan Selvanathan <ss...@gmail.com> 于2020年6月9日周二 下午2:09写道:
> >
> > > 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 88786912@qq.com <88...@qq.com>
> wrote:
> > >
> > > > That's a good idea.
> > > >
> > > >
> > > >
> > > > 88786912@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 <we...@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 <ss...@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/>
> > >
> >
>
-- 
来自 琚致远

Re: Re: Support to import Open API specs to automatically create routes in APISIX [Discuss]

Posted by Nirojan Selvanathan <ss...@gmail.com>.
Yes, the idea is to support Open API v3. Also, I agree with the dashboard
integration option. Therefore, developing this feature as a Node JS
package.

On Thu, 11 Jun 2020, 18:43 hui li, <yo...@apache.org> wrote:

> I have a question, do you mean by open API here Open api v3 or Swagger?
>
> On the other hand, I also think it is more appropriate to support open api
> conversion at the dashboard or api management level.
>
> Thanks
>
> Nirojan Selvanathan <ss...@gmail.com> 于2020年6月9日周二 下午2:09写道:
>
> > 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 88786912@qq.com <88...@qq.com> wrote:
> >
> > > That's a good idea.
> > >
> > >
> > >
> > > 88786912@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 <we...@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 <ss...@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/>
> >
>

Re: Re: Support to import Open API specs to automatically create routes in APISIX [Discuss]

Posted by hui li <yo...@apache.org>.
I have a question, do you mean by open API here Open api v3 or Swagger?

On the other hand, I also think it is more appropriate to support open api
conversion at the dashboard or api management level.

Thanks

Nirojan Selvanathan <ss...@gmail.com> 于2020年6月9日周二 下午2:09写道:

> 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 88786912@qq.com <88...@qq.com> wrote:
>
> > That's a good idea.
> >
> >
> >
> > 88786912@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 <we...@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 <ss...@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/>
>

Re: Re: Support to import Open API specs to automatically create routes in APISIX [Discuss]

Posted by Zhiyuan Ju <ju...@apache.org>.
Yep, just sent a batch request including all information the API needs.

Please go ahead!

Best Regards!
@ Zhiyuan Ju <https://www.shaoyaoju.org/>


Nirojan Selvanathan <ss...@gmail.com> 于2020年6月9日周二 下午2:09写道:

> 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 88786912@qq.com <88...@qq.com> wrote:
>
> > That's a good idea.
> >
> >
> >
> > 88786912@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 <we...@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 <ss...@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/>
>

Re: Re: Support to import Open API specs to automatically create routes in APISIX [Discuss]

Posted by Nirojan Selvanathan <ss...@gmail.com>.
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 88786912@qq.com <88...@qq.com> wrote:

> That's a good idea.
>
>
>
> 88786912@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 <we...@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 <ss...@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/>

Re: Re: Support to import Open API specs to automatically create routes in APISIX [Discuss]

Posted by "88786912@qq.com" <88...@qq.com>.
That's a good idea.



88786912@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 <we...@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 <ss...@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/>
> >
>
-- 
来自 琚致远

Re: Support to import Open API specs to automatically create routes in APISIX [Discuss]

Posted by Zhiyuan Ju <ju...@apache.org>.
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 <we...@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 <ss...@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/>
> >
>
-- 
来自 琚致远

Re: Support to import Open API specs to automatically create routes in APISIX [Discuss]

Posted by Ming Wen <we...@apache.org>.
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 <ss...@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/>
>