housekeeping: corresponding changes for swagger-api/swagger-editor#1935 (via #5170)

* `schema` -> `structural`

* drop strip-instance transformer
This commit is contained in:
kyle
2019-02-08 17:16:18 -06:00
committed by GitHub
parent d3c2e2777f
commit 3434312cf7
3 changed files with 3 additions and 19 deletions

View File

@@ -1,12 +1,10 @@
import reduce from "lodash/reduce"
import * as NotOfType from "./transformers/not-of-type"
import * as ParameterOneOf from "./transformers/parameter-oneof"
import * as StripInstance from "./transformers/strip-instance"
const errorTransformers = [
NotOfType,
ParameterOneOf,
StripInstance
ParameterOneOf
]
export default function transformErrors (errors, system) {

View File

@@ -38,7 +38,7 @@ function createTailoredParameterError(err, jsSpec) {
message,
path: err.get("path") + ".in",
type: "spec",
source: "schema",
source: "structural",
level: "error"
})
}
@@ -49,7 +49,7 @@ function createTailoredParameterError(err, jsSpec) {
message,
path: err.get("path") + ".collectionFormat",
type: "spec",
source: "schema",
source: "structural",
level: "error"
})
}

View File

@@ -1,14 +0,0 @@
export function transform(errors) {
return errors
.map(err => {
if(err.get("type") === "schema") {
return err.set("message", removeSubstring(err.get("message"), "instance\\."))
} else {
return err
}
})
}
function removeSubstring(str, substr) {
return str.replace(new RegExp(substr, "g"), "")
}