Browse Source

modelPropertyMacro, parameterMacro

bubble
Anna Bodnia 7 years ago
parent
commit
edfe88d299
6 changed files with 24 additions and 15 deletions
  1. +8
    -2
      dev-helpers/index.html
  2. +1
    -1
      dist/swagger-ui.css
  3. +7
    -7
      dist/swagger-ui.js
  4. +1
    -1
      dist/swagger-ui.js.map
  5. +2
    -2
      src/core/index.js
  6. +5
    -2
      src/core/plugins/spec/actions.js

+ 8
- 2
dev-helpers/index.html View File

@@ -77,6 +77,12 @@ window.onload = function() {
const ui = SwaggerUIBundle({
url: "http://petstore.swagger.io/v2/swagger.json",
dom_id: '#swagger-ui',
modelPropertyMacro: function (model) {
return model
},
parameterMacro: function (operation, parameter) {
return parameter
},
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
@@ -94,8 +100,8 @@ window.onload = function() {
clientSecret: "your-client-secret-if-required",
realm: "your-realms",
appName: "your-app-name",
scopeSeparator: "-",
additionalQueryStringParams: {test: "hello"}
scopeSeparator: " ",
additionalQueryStringParams: {}
})
}
</script>


+ 1
- 1
dist/swagger-ui.css
File diff suppressed because it is too large
View File


+ 7
- 7
dist/swagger-ui.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/swagger-ui.js.map View File

@@ -1 +1 @@
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;;;;;;AA0yCA;AAoyHA;AA8xHA;AA0kGA;AA+9BA;AA+iCA;AAmjCA;AA25BA","sourceRoot":""}
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;;;;;;AA0yCA;AAoyHA;AAiyHA;AAwkGA;AA48BA;AAqkCA;AA8iCA;AAs6BA","sourceRoot":""}

+ 2
- 2
src/core/index.js View File

@@ -7,8 +7,8 @@ import * as AllPlugins from "core/plugins/all"
import { parseSeach, filterConfigs } from "core/utils"

const CONFIGS = [ "url", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion",
"apisSorter", "operationsSorter", "supportedSubmitMethods", "highlightSizeThreshold", "dom_id",
"defaultModelRendering", "oauth2RedirectUrl", "showRequestHeaders", "custom" ]
"apisSorter", "operationsSorter", "supportedSubmitMethods", "dom_id", "defaultModelRendering", "oauth2RedirectUrl",
"showRequestHeaders", "custom", "modelPropertyMacro", "parameterMacro" ]

// eslint-disable-next-line no-undef
const { GIT_DIRTY, GIT_COMMIT, PACKAGE_VERSION } = buildInfo


+ 5
- 2
src/core/plugins/spec/actions.js View File

@@ -77,7 +77,10 @@ export const parseToJson = (str) => ({specActions, specSelectors, errActions}) =
return specActions.updateJsonSpec(json)
}

export const resolveSpec = (json, url) => ({specActions, specSelectors, errActions, fn: { fetch, resolve, AST }}) => {
export const resolveSpec = (json, url) => ({specActions, specSelectors, errActions, fn: { fetch, resolve, AST }, getConfigs}) => {
const { modelPropertyMacro, parameterMacro } = getConfigs()

debugger
if(typeof(json) === "undefined") {
json = specSelectors.specJson()
}
@@ -89,7 +92,7 @@ export const resolveSpec = (json, url) => ({specActions, specSelectors, errActio

let specStr = specSelectors.specStr()

return resolve({fetch, spec: json, baseDoc: url})
return resolve({fetch, spec: json, baseDoc: url, modelPropertyMacro, parameterMacro })
.then( ({spec, errors}) => {
errActions.clear({
type: "thrown"


Loading…
Cancel
Save