Closed foxx closed 9 years ago
@foxx Can you give us the complete blueprint which is failing to detect a duplicate URL? Thanks.
Hey @foxx a bigger example would be good – are those endpoints nested under a resource or not?
If I specify the same resource URL twice, Snowcrash doesn't seem to detect that there is a duplicate;
Bottom line note: I am starting to question whether this is a correct behavior (constraining the designs to be resource - oriented only). See a possibly related discussion at https://github.com/apiaryio/api-blueprint/pull/198#issuecomment-107368573
I've been able to reproduce this with a clean blueprint, and it seems that a warning is already being raised. Should I close this ticket out, or is it still a valid problem?
FORMAT: 1A
HOST: http://polls.apiblueprint.org/
# test
Polls is a simple API allowing consumers to view polls and vote in them.
# Polls API Root [/]
This resource does not have any attributes. Instead it offers the initial
API affordances in the form of the links in the JSON body.
It is recommend to follow the “url” link values,
[Link](https://tools.ietf.org/html/rfc5988) or Location headers where
applicable to retrieve resources. Instead of constructing your own URLs,
to keep your client decoupled from implementation details.
## Create user [PUT /users]
+ Response 200 (application/json)
{
"questions_url": "/questions"
}
## Create user [PUT /users]
+ Response 200 (application/json)
{
"questions_url": "/questions"
}
@foxx The parser will give warnings for duplicate URLs. You created the issue because you said that snowcrash doesn't detect duplicate URL which I think is a bug. Is there a blueprint where that happens?
is it still a valid problem?
What do you mean by that?
Sorry, this was a huge user error on my part.
It would seem that I did not properly check the warnings output when I initially posted this issue, as when I tried to reproduce it on the web editor the warning was clearly displayed, and when I re-checked protagonist
the warning was displayed as well.
There could be legit situations where duplicate URLs are allowed I guess, therefore I'm going to mark the issue as closed.
Apologies for wasting your time on this guys :(
No worries @foxx :smile:
If I specify the same resource URL twice, Snowcrash doesn't seem to detect that there is a duplicate;
I checked the specification and I cannot seem to find anything on how duplicate resource URLs are handled. In our use case, the only time there would be a duplicate resource URL would be in the event of human error, and I'm struggling to think of any situation where an API Blueprint would need to support duplicates.
On that basis, I'd like to suggest an amendment to the specification which checks if any duplicates exist, and raises an error (or at the very least a warning).
Thoughts?