cloudflare / doca

A CLI tool that scaffolds API documentation based on JSON HyperSchemas.
BSD 3-Clause "New" or "Revised" License
228 stars 36 forks source link

Multiple types not clear in object definition #31

Closed Relequestual closed 7 years ago

Relequestual commented 7 years ago

It's possible for there to be multiple types for a property. Only the first type is shown in the documentation when the type is an array. EDIT: I though that only the first type was shown, but both are, just without any sort of spacing... so I have a "stirngnull". screen shot 2017-01-30 at 14 36 15

This is especially important if you want any fields to be nullable, as you must have a data type of null in addition to what you want for non null values.

Relequestual commented 7 years ago

I tried to fix this by editing https://github.com/cloudflare/doca-bootstrap-theme/blob/master/components/objectDefinitionTable.js#L31 to read

<small><em>{List.isList(definition.get('type')) ? definition.get('type').entrySeq().join(', ') : definition.get('type')}</em></small>

But it caused an error: ERROR in ReferenceError: List is not defined

I used the immutable.js documentation.

@tajo Was I close? What am I missing in my understanding. entrySeq is an immutable.js function right? So I should be able to use other immutable functions and static methods, right?

(At least I worked out how to do npm link OK! =] )

tajo commented 7 years ago

Most likely you are missing

const List = require('immutable').List;

at the beginning

Relequestual commented 7 years ago

Yeah that works... doh. I kinda assumed it would be already required via a dependancy. And as such, I'll be submittng my first PR.