apiaryio / matter_compiler

API Blueprint AST to API Blueprint Conversion Tool [adhd]
MIT License
16 stars 3 forks source link

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

Open rrarunan opened 10 years ago

rrarunan commented 10 years ago

_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?

zdne commented 10 years ago
_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.

rrarunan commented 10 years ago

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 commented 10 years ago

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

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 commented 10 years ago

Same with JSON files & also tested this in Ubuntu:

rrarunan commented 10 years ago

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

rrarunan commented 10 years ago

Will leave it open for you to comment.

zdne commented 10 years ago

@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!