-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
/
Copy pathredocly-cli.rb
92 lines (86 loc) · 3.36 KB
/
redocly-cli.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
class RedoclyCli < Formula
desc "Your all-in-one OpenAPI utility"
homepage "https://redocly.com/docs/cli"
url "https://registry.npmjs.org/@redocly/cli/-/cli-1.34.3.tgz"
sha256 "36e2e9f66eaeebbc69c0528ce7498c3c00854458265e2ce1d64271e788996927"
license "MIT"
head "https://github.com/redocly/redocly-cli.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, arm64_sequoia: "2db136099fa6e416ab4a89bac19d34f732b7365262aad71a9ff93c58856d48db"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "2db136099fa6e416ab4a89bac19d34f732b7365262aad71a9ff93c58856d48db"
sha256 cellar: :any_skip_relocation, arm64_ventura: "2db136099fa6e416ab4a89bac19d34f732b7365262aad71a9ff93c58856d48db"
sha256 cellar: :any_skip_relocation, sonoma: "2100eefa78559107bf5c91de4f02026b3bcfd33122db3ede587b4d2aa95cd4a7"
sha256 cellar: :any_skip_relocation, ventura: "2100eefa78559107bf5c91de4f02026b3bcfd33122db3ede587b4d2aa95cd4a7"
sha256 cellar: :any_skip_relocation, arm64_linux: "2db136099fa6e416ab4a89bac19d34f732b7365262aad71a9ff93c58856d48db"
sha256 cellar: :any_skip_relocation, x86_64_linux: "2db136099fa6e416ab4a89bac19d34f732b7365262aad71a9ff93c58856d48db"
end
depends_on "node"
def install
system "npm", "install", *std_npm_args
bin.install_symlink libexec.glob("bin/*")
end
test do
assert_match version.to_s, shell_output("#{bin}/redocly --version")
test_file = testpath/"openapi.yaml"
test_file.write <<~YML
openapi: '3.0.0'
info:
version: 1.0.0
title: Swagger Petstore
description: test
license:
name: MIT
url: https://opensource.org/licenses/MIT
servers: #ServerList
- url: http://petstore.swagger.io:{Port}/v1
variables:
Port:
enum:
- '8443'
- '443'
default: '8443'
security: [] # SecurityRequirementList
tags: # TagList
- name: pets
description: Test description
- name: store
description: Access to Petstore orders
paths:
/pets:
get:
summary: List all pets
operationId: list_pets
tags:
- pets
parameters:
- name: Accept-Language
in: header
description: 'The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US'
example: en-US
required: false
schema:
type: string
default: en-AU
responses:
'200':
description: An paged array of pets
headers:
x-next:
description: A link to the next page of responses
schema:
type: string
content:
application/json:
encoding:
historyMetadata:
contentType: application/json; charset=utf-8
links:
address:
operationId: getUserAddress
parameters:
userId: $request.path.id
YML
assert_match "Woohoo! Your API description is valid. 🎉",
shell_output("#{bin}/redocly lint --extends=minimal #{test_file} 2>&1")
end
end