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 * 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) {
|
||||
|
||||
@@ -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"
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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