housekeeping: corresponding changes for swagger-api/swagger-editor#1935 (via #5170)
* `schema` -> `structural` * drop strip-instance transformer
This commit is contained in:
@@ -1,12 +1,10 @@
|
|||||||
import reduce from "lodash/reduce"
|
import reduce from "lodash/reduce"
|
||||||
import * as NotOfType from "./transformers/not-of-type"
|
import * as NotOfType from "./transformers/not-of-type"
|
||||||
import * as ParameterOneOf from "./transformers/parameter-oneof"
|
import * as ParameterOneOf from "./transformers/parameter-oneof"
|
||||||
import * as StripInstance from "./transformers/strip-instance"
|
|
||||||
|
|
||||||
const errorTransformers = [
|
const errorTransformers = [
|
||||||
NotOfType,
|
NotOfType,
|
||||||
ParameterOneOf,
|
ParameterOneOf
|
||||||
StripInstance
|
|
||||||
]
|
]
|
||||||
|
|
||||||
export default function transformErrors (errors, system) {
|
export default function transformErrors (errors, system) {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ function createTailoredParameterError(err, jsSpec) {
|
|||||||
message,
|
message,
|
||||||
path: err.get("path") + ".in",
|
path: err.get("path") + ".in",
|
||||||
type: "spec",
|
type: "spec",
|
||||||
source: "schema",
|
source: "structural",
|
||||||
level: "error"
|
level: "error"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ function createTailoredParameterError(err, jsSpec) {
|
|||||||
message,
|
message,
|
||||||
path: err.get("path") + ".collectionFormat",
|
path: err.get("path") + ".collectionFormat",
|
||||||
type: "spec",
|
type: "spec",
|
||||||
source: "schema",
|
source: "structural",
|
||||||
level: "error"
|
level: "error"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"), "")
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user