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

Document @kbn/config-schema. #50307

Merged
merged 9 commits into from
Nov 26, 2019

Conversation

azasypkin
Copy link
Member

@azasypkin azasypkin commented Nov 12, 2019

The attempt to document @kbn/config-schema based on my past knowledge and memory.

cc @jinmu03

Fixes: #39727

[skip-ci]

@azasypkin azasypkin added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:New Platform release_note:skip Skip the PR/issue when compiling release notes v7.5.0 v7.6.0 labels Nov 12, 2019
@azasypkin azasypkin requested review from kobelb and mshustov November 12, 2019 13:58
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@azasypkin
Copy link
Member Author

@restrry @kobelb it's my first attempt to document this library, any suggestions and criticism would be highly appreciated!

@mshustov mshustov requested a review from a team November 12, 2019 14:02
@elasticmachine
Copy link
Contributor

elasticmachine commented Nov 12, 2019

💔 Build Failed


Not relevant to this PR since it touches only *.md file.

@elastic elastic deleted a comment from elasticmachine Nov 12, 2019
@kobelb
Copy link
Contributor

kobelb commented Nov 12, 2019

ACK: reviewing now!

Copy link
Contributor

@kobelb kobelb left a comment

Choose a reason for hiding this comment

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

This is incredibly helpful! I really like the format. All I have is nitpicks because english is a horrible language. Is English better or worse than JavaScript?

packages/kbn-config-schema/README.md Outdated Show resolved Hide resolved
# `@kbn/config-schema` — The Kibana config validation library

`@kbn/config-schema` is a TypeScript library inspired by the Joi and designed to allow run-time validation of the
Kibana configuration entries providing developers with a fully typed model of the validated data.
Copy link
Contributor

Choose a reason for hiding this comment

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

allow run-time validation of the Kibana configuration entries

This is definitely how this started, but it's used in more situations now. For example, at least currently, it's used for HTTP route validation. Perhaps we should keep the current docs until we figure out the scope of where we want this to be used long-term in the NP and rename the package and update the docs at this point?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, its main official focus is still configuration and if decide to recommend using it for anything else we can update this doc then.

packages/kbn-config-schema/README.md Outdated Show resolved Hide resolved
packages/kbn-config-schema/README.md Outdated Show resolved Hide resolved
packages/kbn-config-schema/README.md Outdated Show resolved Hide resolved
packages/kbn-config-schema/README.md Outdated Show resolved Hide resolved
packages/kbn-config-schema/README.md Outdated Show resolved Hide resolved
packages/kbn-config-schema/README.md Outdated Show resolved Hide resolved
packages/kbn-config-schema/README.md Outdated Show resolved Hide resolved
packages/kbn-config-schema/README.md Outdated Show resolved Hide resolved
@azasypkin azasypkin requested a review from kobelb November 13, 2019 14:33
@azasypkin
Copy link
Member Author

@elasticmachine merge upstream

@azasypkin
Copy link
Member Author

Hey @elastic/kibana-platform can someone please take a look at this PR?

@elasticmachine

This comment has been minimized.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded


Validates input data as an object with a predefined set of properties.

__Output type:__ `{ [K in keyof TProps]: TypeOf<TProps[K]> } as TObject`
Copy link
Contributor

Choose a reason for hiding this comment

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

There are no references to TProps in the interface. BTW, if we had those types as comments in TSDoc it would solve the problem.
As a by-product:

  • we can be sure that comments are always in sync with code.
  • have suggestions in IDE.

Copy link
Member Author

@azasypkin azasypkin Nov 26, 2019

Choose a reason for hiding this comment

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

There are no references to TProps in the interface.

True, I struggled to find a better way to describe properties type here. Do you have any suggestions?

BTW, if we had those types as comments in TSDoc it would solve the problem

Yeah, but it sounds like a bigger separate effort, I'd leave it for a follow-up.

```

__Notes:__
* Conditional schemas may be hard to read and understand and hence should be used only sparingly.
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel the same every time I see rxjs.iif
Would it be useful to follow their naming convention and use trueResult/falseResult instead of TConditional1/TConditional2 ?

@azasypkin
Copy link
Member Author

Thanks everyone for review! PR includes only md file change so won't wait for CI run this time.

@azasypkin azasypkin merged commit 0557a40 into elastic:master Nov 26, 2019
@azasypkin azasypkin deleted the issue-39727-document-kbn-config branch November 26, 2019 11:56
@azasypkin azasypkin removed the v7.5.0 label Nov 26, 2019
@azasypkin
Copy link
Member Author

7.x/7.6.0: 52d15e4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported Feature:New Platform release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a readme for /packages/kbn-config-schema
4 participants