matter_compiler icon indicating copy to clipboard operation
matter_compiler copied to clipboard

AST YAML to API Blueprint md: A resource is missing URI template error

Open rrarunan opened this issue 12 years ago • 7 comments

_version: 1.0

metadata:
FORMAT:
    value: 1A

name: <API name>
description: <API description>

resourceGroups:
- name: <resource group name>
  description: <resource group description>

  resources:
- name: <resource name>
  description: <resource description>
  uriTemplate: /testResource/{id}

…
…

Error message: Invalid input: A resource is missing URI template ('<resource name>' resource)

Anything I'm doing wrong in the above YAML AST?

rrarunan avatar Feb 15 '14 11:02 rrarunan

_version: 1.0
metadata:
  FORMAT:
    value: 1A
name: <API name>
description: <API description>
resourceGroups:
- name: <resource group name>
  description: <resource group description>
  resources:
  - name: <resource name>
    description: <resource description>
    uriTemplate: /testResource/{id}

This composes for me into:

FORMAT: 1A

# <API name>
<API description>

# Group <resource group name>
<resource group description>

## <resource name> [/testResource/{id}]
<resource description>

Please check the indentation of your input.

zdne avatar Feb 17 '14 11:02 zdne

I copied the same yaml and tested it out again. I get the same error: Invalid input: A resource is missing URI template ('<resource name>' resource) ..

Is there any restriction on spaces being indented with the correct number ? Like 2 or 4?

Am I running the compiler correctly? I just use : matter_compiler -f yaml test.yaml

rrarunan avatar Feb 21 '14 04:02 rrarunan

I tried one more time with the simple API example ..

  • snowcrash simpleAPI.apib -f json -o testJSON.json
    OK.
  • matter_compiler -f json testJSON.json
    Invalid input: A resource is missing URI template

Don't know if its a platform specific issue. I am using Mac OSX 10.8.5 and ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0] and matter_compiler version 0.4.0.

rrarunan avatar Feb 21 '14 05:02 rrarunan

Same with JSON files & also tested this in Ubuntu:

  • uname -a
    Linux 3.8.0-35-generic #50~precise1-Ubuntu SMP Wed Dec 4 17:25:51 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
  • matter_compiler -f json simpleapi.json
    Invalid input: A resource is missing URI template

rrarunan avatar Feb 21 '14 06:02 rrarunan

I went back to version 0.3.0 git checkout 20f425d, and it works. I guess, the latest changes broke the build?

rrarunan avatar Feb 21 '14 07:02 rrarunan

Will leave it open for you to comment.

rrarunan avatar Feb 21 '14 07:02 rrarunan

@rrarunan

Strange it works on our systems; I won't have time to investigate it until mid next week Since you can reproduce it it would be great if you can look into this issue and try to fix it. I would start investigating at line 449 of blueprint.rb

Thanks for help!

zdne avatar Feb 21 '14 08:02 zdne