Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

docs: add api spec #241

Merged
merged 11 commits into from
Jan 28, 2022
Merged

docs: add api spec #241

merged 11 commits into from
Jan 28, 2022

Conversation

eliseeborn
Copy link
Collaborator

I think this is my first time using scriptappy but it went ok

index: -1,
/**
* Color defined by rgb, argb or html
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe others work as well, but we generally want this to be a hex color

* @type {object}
*/
border: {
/**
* Shop top border
Copy link
Collaborator

Choose a reason for hiding this comment

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

show?

@haxxmaxx
Copy link
Collaborator

Which of these properties are optional? I ran into the problem for the action button that if you want to change like one property for the styling, you override all the others and there are no sanity checks for that in the code, so you have to define the defaults again... What is the case for org chart? Maybe no need to change it, but it is a nicer experience for mashup developers

@eliseeborn eliseeborn changed the title chore: add api spec docs: add api spec Dec 1, 2021
Copy link
Collaborator

@haxxmaxx haxxmaxx left a comment

Choose a reason for hiding this comment

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

LGTM! I'll let @cbt have a look as well

@haxxmaxx haxxmaxx requested a review from cbt1 December 9, 2021 08:35

/**
* @typedef {object} FontColor
* @property {('auto'|'colorPicker'|'byExpression')=} colorType - How the font color is defined, defaults to auto
Copy link
Contributor

@cbt1 cbt1 Dec 13, 2021

Choose a reason for hiding this comment

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

For properties with primitive values and where the value is optional. You can specify a default with something like this I believe:
@property {('auto'|'colorPicker'|'byExpression')} [colorType='auto']

That would should generate a default value in the spec as well so no need to type the default value in the property description.

For the case with objects as props I'll have to get back to you on how to best define that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That is really useful. Would it still be considered a default value even if there is no real default value on the properties per se, but handled with a fallback value in the styling logic? Asking since I wonder if this would work for the table as well

Copy link
Contributor

Choose a reason for hiding this comment

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

I would say the default value is there to indict to the user how the behaviour will be, given that they do not provide a value. So it should not matter how it's implemented. As long as the default value results in the same behaviour as when they do set an explicit value.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Great then I'll add it to my PR as well

"type": "boolean"
},
"fullBorder": {
"description": "fullBorder - Set to true to show full border, default is false",
Copy link
Contributor

Choose a reason for hiding this comment

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

The description looks odd with the property name there as well. Try changing the jsdoc definition to:
@property {boolean} [fullBorder=false] Set to true to show full border

@cbt1
Copy link
Contributor

cbt1 commented Dec 13, 2021

FYI you can run the dev-portal locally the test how the API spec appears in the dev-portal. To get a better sense if it looks alright or not.

@eliseeborn
Copy link
Collaborator Author

Union types don't seem to work on base-level properties :/

Screenshot 2021-12-14 at 12 48 34
Screenshot 2021-12-14 at 12 48 11

Otherwise I think it's looking pretty good once I remove the property names from the description

@eliseeborn
Copy link
Collaborator Author

or no, because properties should be one whole object, which would probably solve the above problem - might just be that I have some issue in my scriptappy setup

Copy link
Collaborator

@niekvanstaveren niekvanstaveren left a comment

Choose a reason for hiding this comment

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

Good stuff!

Comment on lines 30 to 41
{
"kind": "literal",
"value": "'regular'"
},
{
"kind": "literal",
"value": "'scroll'"
},
{
"kind": "literal",
"value": "'free'"
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

These are not the correct options right? I think there is free and expandAll mode. We have talked about different modes, but never implemented any

@@ -33,6 +33,7 @@
"sense": "nebula sense --ext ./src/extension/ext-raw.js --meta ./src/extension/meta.json",
"lint": "eslint src",
"start": "nebula serve --type sn-org-chart",
"spec": "scriptappy-from-jsdoc -c ./spec-configs/props.conf.js",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need to run automatically? E.g. when version is bumped?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll do that in a separate PR

Copy link
Contributor

@cbt1 cbt1 left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 79 to 91
/**
* @typedef {object} FontColor
* @property {('auto'|'colorPicker'|'byExpression')=} [colorType='auto'] How the font color is defined
* @property {PaletteColor=} color - Color defined by index or hex code, needed if colorType is colorPicker
* @property {ColorExpression=} colorExpression - Color defined by expression, needed if colorType is byExpression
*/

/**
* @typedef {object} Background
* @property {('auto'|'colorPicker'|'byExpression')=} [colorType='colorPicker'] How the font color is defined
* @property {PaletteColor=} color - Color defined by index or hex code, needed if colorType is colorPicker
* @property {ColorExpression=} colorExpression - Color defined by expression, needed if colorType is byExpression
*/
Copy link
Collaborator

Choose a reason for hiding this comment

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

These two are identical, could be one generic color type

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They are basically the same, but they have different default values for colorType

Copy link
Collaborator

Choose a reason for hiding this comment

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

you're right, my bad! It still says font on line 88 though

@eliseeborn eliseeborn merged commit 54781b8 into master Jan 28, 2022
@eliseeborn eliseeborn deleted the fdq/api-spec branch January 28, 2022 13:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants