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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e13f630c4b130bf43697303afd645e6b1a4096f2
4
- data.tar.gz: a1f722c98b404306fbf489a6ac1a271668b0a84f
3
+ metadata.gz: a8a3595c4815e2491209423dacd1a141bd77941e
4
+ data.tar.gz: f1ee0b23a570bcc20de9d5971dc0704d8f0563fe
5
5
  SHA512:
6
- metadata.gz: a5411f90dee965254c2bc5a2fc8210ca44aaa72f4d4ce0613a9c890fed56ae297584ae56fbf4aaeef86994cd38d67a33710bf2b3bea5e8a03437de1727e270e8
7
- data.tar.gz: 373232ffed7326fdc78064c7dee831962a6d8e37152f807b0d9fdc1c55aac64b879b0615486407f732865639652649375912c9aee4d42e5650591a3af5bebfa5
6
+ metadata.gz: d16e0c10a04234b6488813a8a889638aaa2b048f863f9028f6ab66140516aacd4531b7be7e7ce49e45ad5e65f8d2da8b338a4bd8a7fb3e2afb18e03efaaba62f
7
+ data.tar.gz: b9cbdaff4a66f23db7d2fd197d7214c3ff0b7b68353f90dce197dfeb68b975a1526cef25bd924bcdca65652bb922993d5a18f47ee6ac205e2ca8abfeffd38d28
data/Gemfile.lock CHANGED
@@ -10,7 +10,7 @@ GIT
10
10
  PATH
11
11
  remote: .
12
12
  specs:
13
- matter_compiler (0.3.0)
13
+ matter_compiler (0.4.0)
14
14
 
15
15
  GEM
16
16
  remote: https://rubygems.org/
@@ -358,7 +358,7 @@
358
358
  When I run `matter_compiler future_ast.yaml`
359
359
  Then it should fail with:
360
360
  """
361
- unsupported AST version
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("unsupported AST version: '#{ast_hash[Blueprint::VERSION_KEY]}'\n")
77
+ abort("Invalid input: Unsupported AST version: '#{ast_hash[Blueprint::VERSION_KEY]}'\n")
78
78
  end
79
79
 
80
80
  # Process the AST hash
@@ -1,3 +1,3 @@
1
1
  module MatterCompiler
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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-07 00:00:00.000000000 Z
11
+ date: 2014-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler