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

Implement JSON format documentation #3762

Closed
wants to merge 2 commits into from

Conversation

rosylilly
Copy link
Contributor

In order to make it easy to extend the documentation, I think that we needed JSON format output.

The current documentation includes HTML, JS, CSS in the compiler. The more i try to make it rich, the more i should add unnecessary assets to the compiler.

Also, if you want to link class names between shards, there is currently no way to parse HTML.

I think that JSON documentation output can solve these problems, what do you think?

ref: #1834 (comment)

@asterite
Copy link
Member

I'll review it soon. Just one thing I saw is that there's JSONise which almost seems like a duplicate of JSON.mapping. Maybe you can create a converter instead of reimplementing JSON.mapping? (check JSON.mapping docs)

In any case I'll review it this week.

@asterite
Copy link
Member

There's also #2777 . I'll take a look at both when I have some time.

@rosylilly
Copy link
Contributor Author

@asterite Crystal::Doc::JSONise.mapping is wrapper and utility for JSON.mapping. Not reimplementation.

Support features below:

  • method -> value: ex: Type#abstract? -> JSONise::Type#abstract : Bool
  • define serializer class: ex: JSONize::TypeRef (This is necessary for weight saving of JSON)

Copy link
Contributor

@RX14 RX14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that a JSON doc output would be very useful, even if it ends up being implemented differently.

def initialize(src : {{src.id}})
{% for key, value in properties %}
{% if value[:wrap] %}
{% if value[:type].is_a?(Generic) %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes that all Generic types are Array(T). Wouldn't it be better to check this assumption? It also seems you use the wrap property to get the generic type. You should be able to use type_vars[0] to get this from the generic.

@straight-shoota
Copy link
Member

This can be closed. #4746 has been merged with JSON output.

@jhass
Copy link
Member

jhass commented Nov 1, 2017

Thank you for contribution @rosylilly and @straight-shoota

@jhass jhass closed this Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants