matter_compiler 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/features/compose.feature +43 -1
- data/lib/matter_compiler/blueprint.rb +6 -0
- data/lib/matter_compiler/composer.rb +1 -1
- data/lib/matter_compiler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8a3595c4815e2491209423dacd1a141bd77941e
|
4
|
+
data.tar.gz: f1ee0b23a570bcc20de9d5971dc0704d8f0563fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d16e0c10a04234b6488813a8a889638aaa2b048f863f9028f6ab66140516aacd4531b7be7e7ce49e45ad5e65f8d2da8b338a4bd8a7fb3e2afb18e03efaaba62f
|
7
|
+
data.tar.gz: b9cbdaff4a66f23db7d2fd197d7214c3ff0b7b68353f90dce197dfeb68b975a1526cef25bd924bcdca65652bb922993d5a18f47ee6ac205e2ca8abfeffd38d28
|
data/Gemfile.lock
CHANGED
data/features/compose.feature
CHANGED
@@ -358,7 +358,7 @@
|
|
358
358
|
When I run `matter_compiler future_ast.yaml`
|
359
359
|
Then it should fail with:
|
360
360
|
"""
|
361
|
-
|
361
|
+
Unsupported AST version
|
362
362
|
"""
|
363
363
|
|
364
364
|
Scenario: Explicitly set API Blueprint Format
|
@@ -377,3 +377,45 @@
|
|
377
377
|
|
378
378
|
# My API
|
379
379
|
"""
|
380
|
+
|
381
|
+
Scenario: Attempt to compose a resource without URI template
|
382
|
+
Given a file named "no-uri-template.yaml" with:
|
383
|
+
"""
|
384
|
+
_version: 1.0
|
385
|
+
metadata:
|
386
|
+
name: My API
|
387
|
+
description:
|
388
|
+
resourceGroups:
|
389
|
+
- name:
|
390
|
+
description:
|
391
|
+
resources:
|
392
|
+
- name:
|
393
|
+
description:
|
394
|
+
uriTemplate:
|
395
|
+
model:
|
396
|
+
parameters:
|
397
|
+
headers:
|
398
|
+
actions:
|
399
|
+
- name:
|
400
|
+
description:
|
401
|
+
method: GET
|
402
|
+
parameters:
|
403
|
+
headers:
|
404
|
+
examples:
|
405
|
+
- name:
|
406
|
+
description:
|
407
|
+
requests:
|
408
|
+
responses:
|
409
|
+
- name: 200
|
410
|
+
description:
|
411
|
+
headers:
|
412
|
+
Content-Type:
|
413
|
+
value: text/plain
|
414
|
+
body: "Hello World!\n"
|
415
|
+
schema:
|
416
|
+
"""
|
417
|
+
When I run `matter_compiler no-uri-template.yaml`
|
418
|
+
Then it should fail with:
|
419
|
+
"""
|
420
|
+
missing URI template
|
421
|
+
"""
|
@@ -446,6 +446,12 @@ module MatterCompiler
|
|
446
446
|
def load_ast_hash!(hash)
|
447
447
|
super(hash)
|
448
448
|
|
449
|
+
if hash[:uriTemplate].blank? || hash[:uriTemplate][0] != '/'
|
450
|
+
failure_message = "Invalid input: A resource is missing URI template"
|
451
|
+
failure_message << " ('#{hash[:name]}' resource)" unless hash[:name].blank?
|
452
|
+
abort(failure_message);
|
453
|
+
end
|
454
|
+
|
449
455
|
@uri_template = hash[:uriTemplate]
|
450
456
|
@model = Model.new(hash[:model]) unless hash[:model].blank?
|
451
457
|
@parameters = Parameters.new(hash[:parameters]) unless hash[:parameters].blank?
|
@@ -74,7 +74,7 @@ module MatterCompiler
|
|
74
74
|
|
75
75
|
# Check version of the AST
|
76
76
|
unless Blueprint::SUPPORTED_VERSIONS.include?(ast_hash[Blueprint::VERSION_KEY].to_s)
|
77
|
-
abort("
|
77
|
+
abort("Invalid input: Unsupported AST version: '#{ast_hash[Blueprint::VERSION_KEY]}'\n")
|
78
78
|
end
|
79
79
|
|
80
80
|
# Process the AST hash
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matter_compiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zdenek Nemec
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|