Git Product home page Git Product logo

kong-spec-expose's Introduction

Kong Spec Expose Plugin

Overview

This plugin will expose the specification of auth protected API services fronted by the Kong gateway.

In short, API Providers need a means of exposing the specification of their services while maintaining authentication on the service itself, we do so by:

  1. Plugin enables Kong users to specify the endpoint of their API specification.

  2. Plugin will validate the Proxy request is GET method, and will validate the proxy request ends with "/specz". If these two requirements are met, the endpoint will return the specification documentation of the API Service with Content-Type header identical to what the API specification exposes.

Supported Kong Releases

Kong >= 1.x

Installation

Recommended:

$ luarocks install kong-spec-expose

Other:

$ git clone https://github.com/Optum/kong-spec-expose.git /path/to/kong/plugins/kong-spec-expose
$ cd /path/to/kong/plugins/kong-spec-expose
$ luarocks make *.rockspec

Maintainers

jeremyjpj0916
rsbrisci

Feel free to open issues, or refer to our Contribution Guidelines if you have any questions.

kong-spec-expose's People

Contributors

amyschoen avatar jeremyjpj0916 avatar rsbrisci avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kong-spec-expose's Issues

Not able to see the documentation

Not able to invoke the plugin - Where should I see the documentation?

I have enabled the plugin on services and route, but unable to view the spec.

I am using kong 2.0 version. What am I missing?

Specz endpoint responses unexpected error

Hi there,

I'm trying plugin on a docker kong instance, I've configured the plugin using the steps posted here, and I've created my endpoint by bellow command:

curl -s -X POST http://10.200.10.1:8001/services -d name=partners -d url=http://partners:8080/partners
curl -s -X POST http://10.200.10.1:8001/services/partners/routes -d name=partRoute -d "paths[]=/partners"
curl -X POST http://10.200.10.1:8001/services/partners/plugins \
    	--data "name=kong-spec-expose"  \
    	--data "config.spec_url=http://partners:9080/api-docs"

However, when I hit the endpoint adding /specz termination, it responses:

curl -X GET http://10.200.10.1:8000/partners/specz
{"message":"An unexpected error occurred"}

Partners microservice exposes its API documentation on this url: http://partners:9080/api-docs.

I'm running Kong 5.1. Kong's log just show this:

kong        | 172.26.0.1 - - [30/Jan/2020:17:23:31 +0000] "GET /partners/specz HTTP/1.1" 500 42 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
kong        | 2020/01/30 17:28:16 [warn] 30#0: *7176 [kong] plugins.lua:164 DEPRECATED: /plugins/schema/:name endpoint is deprecated, please use /schemas/plugins/:name instead., client: 172.26.0.1, server: kong_admin, request: "GET /plugins/schema/kong-spec-expose?size=1000 HTTP/1.1", host: "localhost:8001"

I was wondering if there is something wrong with my configuration.
Thanks

"An unexpected error occurred"

Hello,

So I managed to install the plugin, created the following service:

POST request to https://localhost:8443/admin-api/services
with this JSON body:

{
    "name":"OrdersController",
    "host":"orders-microservice",
    "path":"/api/v1/orders"
}

Note: I secured Kong's Admin API by creating a loopback route, that is why you see admin-api/ there.

Then I added the following route with this POST request:
https://localhost:8443/admin-api/routes
...and this JSON body:

{
  "name":"v1-orders",
  "protocols": ["https"],
  "methods": ["GET","POST","PUT","DELETE"],
  "paths": ["/api/v1/orders"],
  "service": {
      "id": "<ID returned on previous response>"
  }
}

The plugin was added to the route above and the spec URL added was http://localhost:8080/swagger/v1/swagger.json

However, when I send a GET request to https://localhost:8443/api/v1/orders/specz I receive the following error:

{
    "message": "An unexpected error occurred"
}

What am I doing wrong?

Swagger - upstream server address

Hi - I've exposed a swagger endpoint using the kong-spec-expose plugin, but the server address in the swagger document is still the upstream url, not the kong url. Is there a way to substutute this for the kong url? Thanks.

plugin configuration

Hi All,

Referring to this link https://docs.konghq.com/hub/optum/kong-spec-expose/
how to configure this plugin if its a k8s cluster which is connecting via KUBCONFIG from windows machine? please share insights here.
(kong version is 2.8)

$ ./luarocks make *.rockspec
Warning: Could not find Lua 5.4 in PATH.
Modules may not install with the correct configurations. You may want to configure the path prefix to your build of Lua 5.4 using

luarocks config --local lua_dir

Error: Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.

not able to install plugin

I have use kong version 2.0.4.
and I face the following error.

{
"message": "schema violation (name: plugin 'kong-spec-expose' not enabled; add it to the 'plugins' configuration property)",
"name": "schema violation",
"fields": {
"name": "plugin 'kong-spec-expose' not enabled; add it to the 'plugins' configuration property"
},
"code": 2
}

I follow the given steps in the following doc.
https://docs.konghq.com/hub/optum/kong-spec-expose/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.