govuk_tech_docs 6.2.3 → 6.2.4

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: 87a42820b4c7571de0db48c86a823c8510520cfd91e7504e33b82d503eaad139
4
- data.tar.gz: 826755aa09f87263317723aead5ef82cd456b74863f5492c72eea512099d5737
3
+ metadata.gz: 74dc4c44fa70d8f29bb050007da7bfc8740e690f3dda8b4220fc1cbf6246d08d
4
+ data.tar.gz: 972e4b78381b8a0d07384fd65dc8a40889b56458d31e3bfca60098a053e5b794
5
5
  SHA512:
6
- metadata.gz: e3e3f3da335130b1241dd526bc04bf17b9f14c6ed41aec60d4447b847ec6cb2e762a29983edcc4ee251e7adb944f5bd7f8331f147e3c3bd9cf5890867d50d552
7
- data.tar.gz: 0512cb5a6002f61c3ec370e77d95b2c008001ebd2a1686f216d7b8cafe1cc97c1a13e40855d0a4eeba5ba27c1d983a743b9f1413a12d8ef263a4591785a19a9b
6
+ metadata.gz: c9289ca8f68a4b0327d71355929f319dea91d1a8a72dcbb10a7190a51e6cf59f06ed5df79ed7acf3efa7989c180c29c43727931e64b8045741df4a6fa7b25495
7
+ data.tar.gz: 7e02307c317a55e7075c71d537fa0e11c60c7250af9c6851f2e45e6068cb8f8fde3236f9202811049e557047c078a5bd9a48e324ff6f19ae57ae651b4f556dae
@@ -20,7 +20,7 @@ jobs:
20
20
  with:
21
21
  show-progress: false
22
22
 
23
- - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0
23
+ - uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
24
24
  with:
25
25
  ruby-version: '3'
26
26
 
@@ -57,7 +57,7 @@ jobs:
57
57
  node-version-file: '.nvmrc'
58
58
  cache: 'npm'
59
59
 
60
- - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0
60
+ - uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
61
61
  with:
62
62
  ruby-version: '3'
63
63
  bundler-cache: true
@@ -7,6 +7,11 @@ on:
7
7
  branches: [ "main" ]
8
8
  workflow_dispatch:
9
9
 
10
+ permissions:
11
+ contents: read # Allows the action to check out your repository code
12
+ pull-requests: write # Allows the action to comment on or update the Dependabot PR
13
+ statuses: write # Allows the action to post pass/fail build statuses
14
+
10
15
  jobs:
11
16
  test:
12
17
  name: Test
@@ -26,7 +31,7 @@ jobs:
26
31
  node-version-file: '.nvmrc'
27
32
  cache: 'npm'
28
33
 
29
- - uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0
34
+ - uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
30
35
  with:
31
36
  ruby-version: ${{ matrix.ruby }}
32
37
  bundler-cache: true
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 6.2.4
2
+
3
+ - Support non-JSON response content types in OpenAPI renderer.
4
+
1
5
  ## 6.2.3
2
6
 
3
7
  - [Fix TOC sidebar not scrolling to active item on page load](https://github.com/alphagov/tech-docs-gem/pull/480)
@@ -33,6 +33,10 @@ paths:
33
33
  application/json:
34
34
  schema:
35
35
  $ref: "#/components/schemas/Pets"
36
+ text/plain:
37
+ schema:
38
+ type: string
39
+ example: "1: Fido, 2: Buddy, 3: Max"
36
40
  default:
37
41
  description: unexpected error
38
42
  content:
@@ -45,7 +45,7 @@ Gem::Specification.new do |spec|
45
45
  spec.add_dependency "chronic"
46
46
  spec.add_dependency "concurrent-ruby"
47
47
  spec.add_dependency "csv" # TODO: remove once tilt declares this itself.
48
- spec.add_dependency "haml", "~> 6.0" # middleman-core (4.6.3) depends on haml (>= 4.0.5, < 7)
48
+ spec.add_dependency "haml", ">= 6", "< 8" # middleman-core (4.6.3) depends on haml (>= 4.0.5, < 7)
49
49
  spec.add_dependency "middleman"
50
50
  spec.add_dependency "middleman-autoprefixer"
51
51
  spec.add_dependency "middleman-compass"
@@ -58,12 +58,13 @@ module GovukTechDocs
58
58
  operations = get_operations(@document.paths[text])
59
59
  schemas = operations.flat_map do |_, operation|
60
60
  operation.responses.inject([]) do |memo, (_, response)|
61
- next memo unless response.content["application/json"]
61
+ next memo unless response.content
62
62
 
63
- schema = response.content["application/json"].schema
64
-
65
- memo << schema.name if schema.name
66
- memo + schemas_from_schema(schema)
63
+ response.content.values.inject(memo) do |inner_memo, media_type|
64
+ schema = media_type.schema
65
+ inner_memo << schema.name if schema.name
66
+ inner_memo + schemas_from_schema(schema)
67
+ end
67
68
  end
68
69
  end
69
70
 
@@ -10,21 +10,31 @@
10
10
  <td><%= key %></td>
11
11
  <td>
12
12
  <%= render_markdown(response.description) %>
13
- <% if response.content['application/json']
14
- if response.content['application/json']["example"]
15
- request_body = json_prettyprint(response.content['application/json']["example"])
16
- else
17
- request_body = json_output(response.content['application/json'].schema)
18
- end
13
+ <% if response.content %>
14
+ <% response.content.each do |content_type, media_type| %>
15
+ <% request_body = nil
16
+ if content_type.include?("json")
17
+ if media_type["example"]
18
+ request_body = json_prettyprint(media_type["example"])
19
+ else
20
+ request_body = json_output(media_type.schema)
21
+ end
22
+ elsif media_type["example"]
23
+ request_body = media_type["example"].to_s
19
24
  end %>
20
25
  <% if !request_body.blank? %>
21
- <pre><code><%= request_body %></code></pre>
26
+ <p><em><%= content_type %></em></p>
27
+ <pre><code><%= ERB::Util.html_escape(request_body) %></code></pre>
28
+ <% end %>
29
+ <% end %>
22
30
  <% end %>
23
31
  </td>
24
32
  <td>
25
- <%= if response.content['application/json']
26
- get_schema_link(response.content['application/json'].schema)
27
- end %>
33
+ <% if response.content %>
34
+ <% response.content.each do |content_type, media_type| %>
35
+ <%= get_schema_link(media_type.schema) %>
36
+ <% end %>
37
+ <% end %>
28
38
  </td>
29
39
  </tr>
30
40
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module GovukTechDocs
2
- VERSION = "6.2.3".freeze
2
+ VERSION = "6.2.4".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_tech_docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.3
4
+ version: 6.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Government Digital Service
@@ -69,16 +69,22 @@ dependencies:
69
69
  name: haml
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - "~>"
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '6'
75
+ - - "<"
73
76
  - !ruby/object:Gem::Version
74
- version: '6.0'
77
+ version: '8'
75
78
  type: :runtime
76
79
  prerelease: false
77
80
  version_requirements: !ruby/object:Gem::Requirement
78
81
  requirements:
79
- - - "~>"
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '6'
85
+ - - "<"
80
86
  - !ruby/object:Gem::Version
81
- version: '6.0'
87
+ version: '8'
82
88
  - !ruby/object:Gem::Dependency
83
89
  name: middleman
84
90
  requirement: !ruby/object:Gem::Requirement