{"action":"created","issue":{"url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/3968","repository_url":"https://api.github.com/repos/swagger-api/swagger-ui","labels_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/3968/labels{/name}","comments_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/3968/comments","events_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/3968/events","html_url":"https://github.com/swagger-api/swagger-ui/issues/3968","id":278194258,"number":3968,"title":"Plugin for ParameterRow can't seem to wrapComponent correctly","user":{"login":"awalsh-broadsoft","id":17168790,"avatar_url":"https://avatars3.githubusercontent.com/u/17168790?v=4","gravatar_id":"","url":"https://api.github.com/users/awalsh-broadsoft","html_url":"https://github.com/awalsh-broadsoft","followers_url":"https://api.github.com/users/awalsh-broadsoft/followers","following_url":"https://api.github.com/users/awalsh-broadsoft/following{/other_user}","gists_url":"https://api.github.com/users/awalsh-broadsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/awalsh-broadsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awalsh-broadsoft/subscriptions","organizations_url":"https://api.github.com/users/awalsh-broadsoft/orgs","repos_url":"https://api.github.com/users/awalsh-broadsoft/repos","events_url":"https://api.github.com/users/awalsh-broadsoft/events{/privacy}","received_events_url":"https://api.github.com/users/awalsh-broadsoft/received_events","type":"User","site_admin":false},"labels":[{"id":185046751,"url":"https://api.github.com/repos/swagger-api/swagger-ui/labels/Support","name":"Support","color":"bfe5bf","default":false}],"state":"open","locked":false,"assignee":{"login":"shockey","id":680248,"avatar_url":"https://avatars2.githubusercontent.com/u/680248?v=4","gravatar_id":"","url":"https://api.github.com/users/shockey","html_url":"https://github.com/shockey","followers_url":"https://api.github.com/users/shockey/followers","following_url":"https://api.github.com/users/shockey/following{/other_user}","gists_url":"https://api.github.com/users/shockey/gists{/gist_id}","starred_url":"https://api.github.com/users/shockey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shockey/subscriptions","organizations_url":"https://api.github.com/users/shockey/orgs","repos_url":"https://api.github.com/users/shockey/repos","events_url":"https://api.github.com/users/shockey/events{/privacy}","received_events_url":"https://api.github.com/users/shockey/received_events","type":"User","site_admin":false},"assignees":[{"login":"shockey","id":680248,"avatar_url":"https://avatars2.githubusercontent.com/u/680248?v=4","gravatar_id":"","url":"https://api.github.com/users/shockey","html_url":"https://github.com/shockey","followers_url":"https://api.github.com/users/shockey/followers","following_url":"https://api.github.com/users/shockey/following{/other_user}","gists_url":"https://api.github.com/users/shockey/gists{/gist_id}","starred_url":"https://api.github.com/users/shockey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shockey/subscriptions","organizations_url":"https://api.github.com/users/shockey/orgs","repos_url":"https://api.github.com/users/shockey/repos","events_url":"https://api.github.com/users/shockey/events{/privacy}","received_events_url":"https://api.github.com/users/shockey/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2017-11-30T16:55:41Z","updated_at":"2017-12-05T18:55:49Z","closed_at":null,"author_association":"NONE","body":"| Q                               | A\r\n| ------------------------------- | -------\r\n| Bug or feature request?         |  Bug/Support\r\n| Which Swagger/OpenAPI version?  | 3.0.0\r\n| Which Swagger-UI version?       | 3.5\r\n| How did you install Swagger-UI? | Tomcat\r\n| Which browser & version?        | Chrome\r\n| Which operating system?         | Windows 10 Pro\r\n\r\n\r\n### Demonstration API definition\r\nI'm attempting to create a plugin using wrapComponent for ParameterRow. I have the top bar replaced with a new one, so I'm pretty sure my setup is working. However, it seems like I can't do a wrapComponent on ParameterRow.\r\n\r\n```js\r\nclass ParameterRow extends Component {\r\n...Make some changes...\r\n}\r\n\r\nexport const MyParameterRowPlugin = function() {\r\n  return {\r\n    wrapComponents: {\r\n      ParameterRow\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nHere's my webpack.config.js:\r\n```js\r\nconst webpack = require('webpack')\r\nconst path = require('path')\r\n\r\nmodule.exports = {\r\n  entry: {\r\n    'swagger-ui-broadsoft': [\r\n      './src/index.js'\r\n    ]\r\n  },\r\n\r\n  output: {\r\n    path: path.join(__dirname, 'dist'),\r\n    library: 'MySwaggerUI',\r\n    libraryTarget: 'umd',\r\n    filename: 'my-swagger-ui.min.js'\r\n  },\r\n\r\n  externals: (ctx, req, next) => {\r\n    next(null, false)\r\n  },\r\n\r\n  module: {\r\n    loaders: [{\r\n      test: /\\.js(x)?$/,\r\n      loader: 'babel-loader',\r\n      exclude: [\r\n        /node_modules/\r\n      ],\r\n      query: {\r\n        presets: ['react', 'es2015', 'stage-2']\r\n      }\r\n    },{\r\n      test: /\\.(png|jpg|jpeg|gif|svg)(\\?.*)?$/,\r\n      loader: \"url-loader?limit=10000\"\r\n    }]\r\n  },\r\n\r\n  resolve: {\r\n    modules: ['node_modules'],\r\n    extensions: ['.js', '.json']\r\n  },\r\n\r\n  plugins: [\r\n    new webpack.DefinePlugin({\r\n      'process.env': {\r\n        NODE_ENV: JSON.stringify('production')\r\n      }\r\n    })\r\n  ]\r\n}\r\n```\r\n\r\nAnd my index.js:\r\n```js\r\nimport * as topbar from \"./MyTopbarPlugin.js\"\r\nimport * as queryparam from \"./MyParameterRowPlugin.js\"\r\n\r\nmodule.exports.MyTopbarPlugin = topbar.MyTopbarPlugin;\r\nmodule.exports.MyParameterRowPlugin = queryparam.MyParameterRowPlugin ;\r\n```\r\n\r\nAny ideas?\r\n\r\n### Expected Behavior\r\nThe parameter row's behavior should change.\r\n\r\n### Current Behavior\r\nThe parameter row's behavior is unchanged.\r\n\r\n### Context\r\nI'm wanting to change the parameter row so that any parameter with a \"schema\" creates a \"ParamBody\". This behavior should happen regardless of whether or not the \"in\" has \"body\" as it's value.\r\n"},"comment":{"url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/comments/349404658","html_url":"https://github.com/swagger-api/swagger-ui/issues/3968#issuecomment-349404658","issue_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/3968","id":349404658,"user":{"login":"thompsongl","id":2728212,"avatar_url":"https://avatars0.githubusercontent.com/u/2728212?v=4","gravatar_id":"","url":"https://api.github.com/users/thompsongl","html_url":"https://github.com/thompsongl","followers_url":"https://api.github.com/users/thompsongl/followers","following_url":"https://api.github.com/users/thompsongl/following{/other_user}","gists_url":"https://api.github.com/users/thompsongl/gists{/gist_id}","starred_url":"https://api.github.com/users/thompsongl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thompsongl/subscriptions","organizations_url":"https://api.github.com/users/thompsongl/orgs","repos_url":"https://api.github.com/users/thompsongl/repos","events_url":"https://api.github.com/users/thompsongl/events{/privacy}","received_events_url":"https://api.github.com/users/thompsongl/received_events","type":"User","site_admin":false},"created_at":"2017-12-05T18:55:49Z","updated_at":"2017-12-05T18:55:49Z","author_association":"CONTRIBUTOR","body":"I think the problem stems from `components` vs `wrapComponents` plugins.\r\n\r\n`wrapComponents` expects a function that returns a component:\r\n```\r\nexport const MyParameterRowPlugin = function() {\r\n  return {\r\n    wrapComponents: {\r\n      ParameterRow: (Original, system) => {\r\n        return class ParameterRowWrap extends Component {\r\n        ...Make some changes...\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nWhereas `components` expects a component (like you currently have):\r\n```\r\nclass ParameterRow extends Component {\r\n...Make some changes...\r\n}\r\n\r\nexport const MyParameterRowPlugin = function() {\r\n  return {\r\n    components: {\r\n      ParameterRow\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nAlso, I've found that modifying/overriding core components needs to happen in `presets` instead of `plugins`."}}
{"actor":{"display_login":"thompsongl"}}