swagger-api/swagger-ui

make component names case insensitive. ie: getComponent("fooBaR")

Open

#3,393 建立於 2017年7月15日

在 GitHub 查看
 (14 留言) (3 反應) (0 負責人)JavaScript (25,447 star) (8,801 fork)batch import
Good first issuepull-request-welcometype: feature

描述

The plugin system exposes a way to get components via system.getComponent(). Up till now its been case sensitive. Unfortunately we never put in a style-guide on what case to use. So we have lowercase, TitleCase components mixed throughout.

I propose we make them case-insensitive.

  • When building the system, we store the downcased name of the component in our object.
  • When fetching, we downcase the argument to getComponent in order to fetch it from our object.

eg:

//...
plugins = [ { components: { wONderBAR: () => <h1> Hi </h1> } } ]
// stored as  { wonderbar: .... }

system.getComponent("wonderBAR") // the component keyed with "wonderbar"

This is to allow any case, and not break any existing code. That said, we should likely normalize the component names in this codebase to be consistent.

Guestimate of work effort: < Normal

@shockey your thoughts?

貢獻者指南