Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support attribute enumeration for targetSchema #294

Open
duckpunch opened this issue May 24, 2016 · 5 comments
Open

Support attribute enumeration for targetSchema #294

duckpunch opened this issue May 24, 2016 · 5 comments

Comments

@duckpunch
Copy link

When describing the response in Markdown, prmd only provides an example. It'd be great to enumerate the attributes of the targetSchema like it is enumerated for the request parameters.

I wasn't sure if this is something that would be palatable. If it is, I'd be happy to submit a PR (or just wait for an update!)

@geemus
Copy link
Member

geemus commented May 25, 2016

I guess we hadn't really considered that too much as we tend to have parity between the properties of the resource and what is in the example (so it seemed redundant to list it again in the response when it was already available elsewhere). Maybe we should make that more explicit or link though. That said, could you provide a more explicit/concrete example of what you think the schema and output might look like? I think that could really help make sure we are on the same page before we deal with implementation details. Thanks!

@duckpunch
Copy link
Author

Good point about the parity that naturally happens. That kills some of the use cases I had in mind :P

We're using JSONAPI which can sometimes have pretty complicated responses. One use case for enumerating attributes is when describing errors. This might be conflating #295.

Here's an example snippet of a response which is a JSONAPI error object that might be returned after a POST. The example is for a validation error which is difficult for the client to detect upon submission.

{
  "errors": [
    {
      "code": "overlapping-time-range",
      "detail": "Entry with time range (A, B) causes an overlap with an existing record"
    }
  ]
}

It'd be neat if the documentation could enumerate the codes like the other enums. Further, it would be useful to know what kind of details would be provided. There are also other fields that could use a description beyond the JSONAPI spec.

@geemus
Copy link
Member

geemus commented May 26, 2016

Yeah. It might fit to do something in this area using something like oneOf to show that it could be one of the errors or the expected thing, but I don't think it would be setup to "just work" at this point. Plus we would need to think about how the output would appear in that case. I guess I worry a bit that it might get really verbose, really quickly. The way we have handled this has been to have a portion of introductory text that explains the common error patterns you might expect, but then doesn't repeat/expand upon them in the particular cases. Does that make sense/help at all? It may well be time to revisit/expand on that though.

@duckpunch
Copy link
Author

That makes sense.

Maybe using oneOf, we could provide $ref links which link to HTML anchors defining the error. This would probably require defining errors more rigorously.

@geemus
Copy link
Member

geemus commented May 31, 2016

Interesting, yeah that sounds like a good balance between individual specificity and not duplicating a bunch of stuff.

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

No branches or pull requests

2 participants