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

Add missing JSON field to docs generator output for constants #6218

Merged
merged 1 commit into from
Jun 21, 2018

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Jun 19, 2018

Fixes #6202

The id field was missing in the JSON serialization of constants, resulting in an undefined value when using it to generate link targets for search results.
I added Constant#id and used this in the template as well, instead of reusing Constant#name to be more explicit (although both methods return the same value) and to have a consistent interface like the other classes where id and name are usually different.

@bcardiff
Copy link
Member

@straight-shoota Could you point where the id read and missing?

@straight-shoota
Copy link
Member Author

results.push({
id: constant.id,
type: type.full_name,
result_type: "constant",
name: constant.name,
full_name: type.full_name + "#" + constant.name,
value: constant.value,
summary: constant.summary,
href: type.path + "#" + constant.id,
matched_fields: matchedFields,
matched_terms: matches
});

@bcardiff bcardiff added kind:docs kind:bug A bug in the code. Does not apply to documentation, specs, etc. labels Jun 21, 2018
@bcardiff bcardiff merged commit 666c192 into crystal-lang:master Jun 21, 2018
@bcardiff bcardiff added this to the 0.25.1 milestone Jun 21, 2018
@bcardiff
Copy link
Member

Great! thanks for clarifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. kind:docs topic:compiler topic:tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants