refactor(oas31): change License component to be smart (#8476)

Refs #8474
This commit is contained in:
Vladimír Gorej
2023-03-16 15:54:59 +01:00
committed by GitHub
parent 8b274414ab
commit 990d1f288e
7 changed files with 98 additions and 50 deletions

View File

@@ -6,11 +6,22 @@ import License from "./components/license"
import Info from "./components/info"
import LicenseWrapper from "./wrap-components/license"
import InfoWrapper from "./wrap-components/info"
import { isOAS31, webhooks } from "./spec-extensions/selectors"
import { isOAS31, license, webhooks } from "./spec-extensions/selectors"
import { isOAS3 } from "./spec-extensions/wrap-selectors"
import {
makeSelectLicenseUrl,
selectLicenseIdentifierField,
selectLicenseNameField,
selectLicenseUrlField,
} from "./selectors"
const OAS31Plugin = () => {
return {
afterLoad(system) {
const oas31Selectors = this.statePlugins.oas31.selectors
oas31Selectors.selectLicenseUrl = makeSelectLicenseUrl(system)
},
components: {
Webhooks,
OAS31Info: Info,
@@ -24,12 +35,20 @@ const OAS31Plugin = () => {
spec: {
selectors: {
isOAS31,
license,
webhooks,
},
wrapSelectors: {
isOAS3,
},
},
oas31: {
selectors: {
selectLicenseNameField,
selectLicenseUrlField,
selectLicenseIdentifierField,
},
},
},
}
}