Skip to content

Enforce camelCase format for a plugin id#53759

Merged
mshustov merged 17 commits intoelastic:masterfrom
mshustov:issue-52190-id-camelCase
Jan 18, 2020
Merged

Enforce camelCase format for a plugin id#53759
mshustov merged 17 commits intoelastic:masterfrom
mshustov:issue-52190-id-camelCase

Conversation

@mshustov
Copy link
Copy Markdown
Contributor

@mshustov mshustov commented Dec 23, 2019

Summary

Closes #52190, #51226
Validates that pluginId set in camelCase.
configPath fallback to plugin id formated to snake_case automatically.
Adds requirements to the plugin manifest docs.

I added my concerns about the current implementation #52190 (comment)

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

Dev docs

When creating a new platform plugin, you need to make sure that pluginId declared in camelCase within kibana.json manifest file. It might not match pluginPath, which is recommended to be in snake_case format.

// ok
"pluginPath": ["foo"],
"id": "foo"
// ok
"pluginPath": "foo_bar",
"id": "fooBar"

@mshustov mshustov requested a review from a team as a code owner December 23, 2019 11:07
@mshustov mshustov added Feature:New Platform release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// v7.6.0 labels Dec 23, 2019
@elasticmachine
Copy link
Copy Markdown
Contributor

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

@mshustov
Copy link
Copy Markdown
Contributor Author

@pgayvallet @joshdover updated the fallback mechanism to format pluginId to snake_case automatically, following the outcome of #52190
There are 2 plugins with id in camelCase that don't specify pluginPath: uiActions & advancedUiActions. Both of them don't use config, therefore they shouldn't be affected by the pluginPath auto-formatting.

@mshustov mshustov requested review from a team and pgayvallet January 13, 2020 13:02
Comment on lines -124 to +125
* to "id".
* to "id" in snake_case format.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NIT: Maybe add an exemple myId => my_id

@mshustov mshustov added v7.7.0 and removed v7.6.0 labels Jan 15, 2020
@mshustov
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@mshustov
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@mshustov
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@mshustov mshustov merged commit ec31611 into elastic:master Jan 18, 2020
@mshustov mshustov deleted the issue-52190-id-camelCase branch January 18, 2020 13:17
mshustov added a commit to mshustov/kibana that referenced this pull request Jan 18, 2020
* add isCamelCase  function

* add a warning if id is not in camelCase

* document pluginId expected in camelCase

* regen docs

* add a test for logging

* update tests. warn can be called several times for different reasons

* pluginPath falls back to plugin id in snake_case

* update tests

* update docs

* add example with id & configPath different formats

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
mshustov added a commit that referenced this pull request Jan 18, 2020
* add isCamelCase  function

* add a warning if id is not in camelCase

* document pluginId expected in camelCase

* regen docs

* add a test for logging

* update tests. warn can be called several times for different reasons

* pluginPath falls back to plugin id in snake_case

* update tests

* update docs

* add example with id & configPath different formats

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 20, 2020
* upstream/master: (24 commits)
  Show error page when accessing unavailable app (elastic#54656)
  [ML] Improving job wizards with datafeed aggregations (elastic#55180)
  remove flaly assetion. a license presence tested anyway (elastic#55289)
  fix commonly used ranges uptime (elastic#54930)
  [SIEM] Use proper icons on Detections view (elastic#55215)
  Fix: invalid translation referenced (elastic#54901)
  [State Management] Remove AppState from edit_index_pattern page (elastic#54104)
  Implements `getStartServices` on server-side (elastic#55156)
  Move vis_vega_type/data_model tests to jest (elastic#55186)
  [SIEM] [Detection Engine] Update status on rule details page (elastic#55201)
  Fix KQL value suggestions for nested fields (elastic#54820)
  Enforce camelCase format for a plugin id (elastic#53759)
  [SIEM] Detection engine cleanup for rule details/creation/edit page (elastic#55069)
  Remove nested root from index pattern (elastic#54978)
  [Reporting/Migration] ReportingSetup, LegacySetup (elastic#54198)
  [SIEM] [Detection Engine] Fixes duplicate rule action (elastic#55252)
  [SIEM] Detections add alert & signal tab (elastic#55127)
  Management API - redirect on disabled app path (elastic#55136)
  [SIEM][Detection Engine] Fixes critical regression on the backend with immutable and tags
  update local (elastic#55177)
  ...
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 20, 2020
* master: (108 commits)
  [ML] Single Metric Viewer: Fix job check. (elastic#55191)
  Show error page when accessing unavailable app (elastic#54656)
  [ML] Improving job wizards with datafeed aggregations (elastic#55180)
  remove flaly assetion. a license presence tested anyway (elastic#55289)
  fix commonly used ranges uptime (elastic#54930)
  [SIEM] Use proper icons on Detections view (elastic#55215)
  Fix: invalid translation referenced (elastic#54901)
  [State Management] Remove AppState from edit_index_pattern page (elastic#54104)
  Implements `getStartServices` on server-side (elastic#55156)
  Move vis_vega_type/data_model tests to jest (elastic#55186)
  [SIEM] [Detection Engine] Update status on rule details page (elastic#55201)
  Fix KQL value suggestions for nested fields (elastic#54820)
  Enforce camelCase format for a plugin id (elastic#53759)
  [SIEM] Detection engine cleanup for rule details/creation/edit page (elastic#55069)
  Remove nested root from index pattern (elastic#54978)
  [Reporting/Migration] ReportingSetup, LegacySetup (elastic#54198)
  [SIEM] [Detection Engine] Fixes duplicate rule action (elastic#55252)
  [SIEM] Detections add alert & signal tab (elastic#55127)
  Management API - redirect on disabled app path (elastic#55136)
  [SIEM][Detection Engine] Fixes critical regression on the backend with immutable and tags
  ...
@fbaligand
Copy link
Copy Markdown
Contributor

So it means that an existing community plugin named “enhanced-table” has to change its id?
And so every plugin user has all his existing visualizations broken?

@VijayDoshi
Copy link
Copy Markdown

The warnings on startup are numerous, why is enforcement of camelCase useful here? I could be missing context so am happy to learn.
Screen Shot 2020-01-22 at 4 21 36 PM

@pgayvallet
Copy link
Copy Markdown
Contributor

@fbaligand This is currently only showing a warning. Post 8.0 this will probably be a requirement.

@VijayDoshi this is a subtask of enforcing some code/name conventions on plugins. See #52190 for context and reasons of this change.

@fbaligand
Copy link
Copy Markdown
Contributor

Thanks for answer. Nice to see that real requirement won’t happen before 8.0.

I’m quite confused about the exact required name convention: is it enhancedTable or enhanced_table ?

@pgayvallet
Copy link
Copy Markdown
Contributor

Plugin name should be camelCase and would be enhancedTable. As explained in #52190 the main reason for this is that plugin id is part of the plugin's contract, as it's this value that is used to retrieve a dependency plugin by it's id.

Associated default configuration path (if not explicitly specified in the plugin's kibana.json) would be enhanced_table (This is to ensure consistency with the ES stack's configuration properties naming conventions which uses snake_case for config files props)

@fbaligand
Copy link
Copy Markdown
Contributor

Ok, thanks.

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:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// v7.7.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document and enforce camelCase plugin id format

7 participants