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

Doesn't handle links to parameter references #33

Closed
beardedlinuxgeek opened this issue Jan 16, 2017 · 12 comments · Fixed by #131
Closed

Doesn't handle links to parameter references #33

beardedlinuxgeek opened this issue Jan 16, 2017 · 12 comments · Fixed by #131

Comments

@beardedlinuxgeek
Copy link

When you have

"schema": {
    "$ref": "#/definitions/User"
}

then it will link to the User definition at the bottom. But if you have

"parameters": [{
    "$ref": "#/parameters/username"
}]

then the link is still created but because the parameter definitions are never added, there is nothing to link to. Also the description field doesn't get populated from the referenced parameter.

@jimmyjames
Copy link

Seeing this issue as well. Would be nice if the parameter description were inlined into the param description.

@auscaster
Copy link
Member

Thanks guys, noted. If anyone has fixed this issue a PR would be very welcome. Its a simple fix, but will be away myself for the next couple of weeks so will be unable to take care of it straight away

@jimmyjames
Copy link

I may be able to submit a PR but am just getting up to speed with how spectacle works. Any nudges in the right direction is appreciated ;)

@auscaster
Copy link
Member

auscaster commented Jan 26, 2017 via email

@jimmyjames
Copy link

I think the issue is that because it's a reference to a parameter type (we have common parameters for many apis), it ends up in the json-schema/reference template, which then just gets the url fixed up in helpers/schemaSubschemaName. That only accounts for #/definitions, which is fine for schema definitions. Parameters aren't rendered (and I think it would be odd to have parameters rendered themselves like schema definitions are) and the same code is used to handle definition links. What I would like is for the parameter reference to not be a link to its definition, but to be expanded inline. As a user it makes the most sense to view it that way, rather than have to navigate somewhere else and back.

I'll poke around some more to see how easy it would be to make that kind of change, but it seems spectacle makes an assumption that all $ref links should be links to their actual definition.

@auscaster
Copy link
Member

auscaster commented Jan 27, 2017 via email

@auscaster
Copy link
Member

We have an ongoing PR over here for resolving remote references, there may be some crossover: #41

@CodeLenny
Copy link
Contributor

@auscaster I'll probably be able to roll this into #41.

I'm guessing that I'll be using some config in the preprocessor to determine if references should be imported into each usage, or put in the global definitions and referenced from there. Then it's up to downstream elements to produce documentation for the parameters section, like it does for the definitions section.

@rjmanzer
Copy link

rjmanzer commented Jun 9, 2017

Did this ever get implemented? Links to parameters looks to still be broken.

@adamlc
Copy link

adamlc commented Aug 9, 2017

This is still broken for me too 😢

@auscaster
Copy link
Member

auscaster commented Aug 10, 2017 via email

@auscaster
Copy link
Member

Fixed via PR, thanks so much :)

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

Successfully merging a pull request may close this issue.

6 participants