krakend-openapi-importer 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fa4ce1569286791f7a82d516f39378a66443d7e62edb4fcb58f91e44a34e71c
4
- data.tar.gz: 2481a698b885aa0f7e958e86abaa608b433b25b9ad927c5e02aaeaa4daaebdda
3
+ metadata.gz: 42f8decc7a78765c173ba1fcbc56921b83e4b80f9e64528e2038b3a5582c57c1
4
+ data.tar.gz: 8cc805c646fd57bb4b4ff509c93d15ff1ef11fc44efdf2ba7b17c4187a47aeb4
5
5
  SHA512:
6
- metadata.gz: 92c1c325b4bc2a16302fb75df279fd8cb62f305d3379c27e1d91f52fdbf109a8604b20343640a9fcaf1412585e1065c82433112d7e746b74e9672d23e6262416
7
- data.tar.gz: a3a73662c1d3e274e82d29a357e82004fe5ed6408afd51feac8795efac9ba7929b265e5fa4c9c45741818407d63e7d44cb37f7ba97c680ab0623ee3df68a2037
6
+ metadata.gz: 87882d563ba41ef98c9e8d989ee6386b1e4060a80c08a2fe208cec5c0c178734340f13148fad37613b5961e8be42f600c317a373fd8b07c37e91e0bbe2cade8e
7
+ data.tar.gz: cb38f67effdc5439ad893d3a39f2d0544307e1e487dd9f9fbae22b97906c0326dd27ec7be7521951c645b77c293af530ee041838af5035e55817f44037431322
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- krakend-openapi-importer (1.0.0)
4
+ krakend-openapi-importer (1.1.0)
5
5
  thor (~> 1.2)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -4,7 +4,8 @@ Import endpoints from OpenAPI spec to KrakenD endpoint configuration. Supports O
4
4
 
5
5
  [![Ruby](https://github.com/denblackstache/krakend-openapi-importer/actions/workflows/main.yml/badge.svg)](https://github.com/denblackstache/krakend-openapi-importer/actions/workflows/main.yml) [![Gem Version](https://badge.fury.io/rb/krakend-openapi-importer.svg)](https://badge.fury.io/rb/krakend-openapi-importer)
6
6
 
7
- In case you have a different version of OpenAPI you can use <https://github.com/LucyBot-Inc/api-spec-converter> to convert to the v3.0.
7
+ * In case you have a different version of OpenAPI you can use <https://github.com/LucyBot-Inc/api-spec-converter> to convert to the v3.0.
8
+ * Supported Ruby versions: 2.7 and up
8
9
 
9
10
  ## Installation
10
11
 
@@ -31,10 +32,10 @@ Example config
31
32
 
32
33
  ```yaml
33
34
  ---
34
- all_roles: ["admin", "guest"] # all available roles for JWT validator
35
- pretty: true
36
- format: "json" # can be 'json' or 'yaml', defaults to `json`
37
- output: "output.json"
35
+ format: "json" # can be 'json' or 'yaml', optional, defaults to 'json'
36
+ pretty: false # make JSON pretty, optional, defaults to false
37
+ output: "output.json" # output file name, optional, defaults to 'output.json'
38
+ all_roles: ["guest"] # fall back roles for auth validator plugin when operation 'x-jwt-roles` are not specified, optional
38
39
  defaults:
39
40
  base:
40
41
  name: Example application
@@ -44,6 +45,7 @@ defaults:
44
45
  input_query_strings: ["*"]
45
46
  backend:
46
47
  - encoding: "no-op"
48
+ host: [ "https://example.org" ]
47
49
  plugins:
48
50
  auth_validator:
49
51
  alg: "RS256"
@@ -52,9 +54,14 @@ defaults:
52
54
  operation_debug: true
53
55
  roles_key: "realm_access.roles"
54
56
  roles_key_is_nested: true
55
- scopes_key: scopes # only needed when defining scopes in openapi spec
57
+ scopes_key: scopes # only needed when defining scopes in OpenAPI spec
56
58
  ```
57
59
 
60
+ ### Auth Validator plugin configuration
61
+
62
+ * You can specify custom roles for each OpenAPI [operation](https://swagger.io/specification/v3/#operation-object) using the `x-jwt-roles` [operation extension](https://swagger.io/specification/v3/#specification-extensions). If no `x-jwt-roles` are provided for an operation, the plugin will fall back to the default roles defined in the `all_roles` configuration.
63
+ * Importer supports `openIdConnect` and `oauth2` security schemes defined using [Security Requirement Objects](https://swagger.io/specification/v3/#security-requirement-object).
64
+
58
65
  ## Development
59
66
 
60
67
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KrakendOpenAPI
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -60,7 +60,11 @@ module KrakendOpenAPI
60
60
  output_encoding: @importer_config['defaults']&.dig('endpoint', 'output_encoding'),
61
61
  input_headers: @importer_config['defaults']&.dig('endpoint', 'input_headers'),
62
62
  input_query_strings: @importer_config['defaults']&.dig('endpoint', 'input_query_strings'),
63
- backend: [{ url_pattern: path, encoding: @importer_config['defaults']&.dig('backend', 0, 'encoding') }.compact]
63
+ backend: [{
64
+ url_pattern: path,
65
+ encoding: @importer_config['defaults']&.dig('backend', 0, 'encoding'),
66
+ host: @importer_config['defaults']&.dig('backend', 0, 'host')
67
+ }.compact]
64
68
  }.compact
65
69
  end
66
70
 
@@ -14,7 +14,7 @@ module KrakendOpenAPI
14
14
 
15
15
  def write
16
16
  config = {
17
- '$schema': 'https://www.krakend.io/schema/v3.json',
17
+ '$schema': 'https://www.krakend.io/schema/v2.3/krakend.json',
18
18
  version: 3
19
19
  }
20
20
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: krakend-openapi-importer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Semenenko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-06 00:00:00.000000000 Z
11
+ date: 2025-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor