Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Strange error for incorrect document #556

Closed
goganchic opened this issue Jun 21, 2018 · 4 comments · Fixed by #560
Closed

Strange error for incorrect document #556

goganchic opened this issue Jun 21, 2018 · 4 comments · Fixed by #560
Labels

Comments

@goganchic
Copy link
Contributor

goganchic commented Jun 21, 2018

I'm looking throw function parseTypeSpecification and try to find out how Drafter process such invalid document:

# My API

# Data Structures

# Foo[Hello]

+ a
+ b

# GET /foo

+ Response 200 (application/json)
    + Attributes (array[Foo[Hello]], fixed-type)

When I start Drafter I get such error:

./bin/drafter test.apib
Assertion failed: (hasValue_), function get, file ../src/refract/Element.h, line 70.
[1]    55413 abort      ./bin/drafter test.apib

So I have several questions:

  • Is it ok to use brackets in Named Type name?
  • Is it a valid error for such document?
  • What is formal definition of such error? (e.g. I should not use brackets in type definition or something like this)

Used Drafter version: master branch, commit 2318c78

@kylef
Copy link
Member

kylef commented Jun 21, 2018

Just to note, Drafter 3.2.7 (stable) parses this document without producing any warnings or errors.

One problem in the document is that you have not placed Foo[Hello] in a Data Structures section so subsequently it is treated as the description of the My API. If the definition was moved to a Data Structures section then you'd see a warning to escape the name as it contains reserved characters of [ and ].

Didn't look into it much further but does look like a regression in master that we should address. Not sure if the behaviour in 3.2.7 is correct either though.

@kylef kylef added the bug label Jun 21, 2018
@goganchic
Copy link
Contributor Author

goganchic commented Jun 21, 2018

@kylef sorry, I've forgot to insert Data Structures section when copy/paste code into ticket. I've fixed ticket description. Error is the same. No warnings generated. I've built drafter from master branch.

@pksunkara
Copy link
Contributor

Definitely a regression.

@kylef
Copy link
Member

kylef commented Jun 26, 2018

Yes, I've created internal issue in JIRA to tracks this. The problem is with referencing unknown types in array[]. The minimal document is the following:

FORMAT: 1A

# GET /

+ Response 200 (application/json)
    + Attributes (array[Unknown])

We'll schedule into upcoming engineering sprint and get this fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants