-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a Validation
that checks all operationId
s in Link
objects are valid
#236
Comments
Hey @mattpolzin This is still necessary? I was thinking on giving a shot doing this one. If so, can you point me out how you were thinking on implement this? |
This isn't necessary to release v3.0.0, but I do still want to have this validation. This will get implemented similarly to other optional validations (it won't get added to the default-on validations here: https://github.com/mattpolzin/OpenAPIKit/blob/release/3_0/Sources/OpenAPIKit/Validator/Validator.swift#L182..L195). It will still be exposed as a property on the This particular validation may or may not be a bit tricky to implement now that I am thinking about it a bit more, simply because it must start with the context of a If you still want to take a crack at it, you would start with something like: public static var linkOperationsExist: Validation<OpenAPI.Link> {
.init(
description: "Links with operationIds have corresponding Operations",
check: { context in
guard case let .b(operationId) = context.subject.operation else {
// don't make assertions about Links that don't have operationIds
return true
}
// TODO: look at all Operations in the document and see if any have the
// given operationId
let operationIdFound: Bool
return operationIdFound
}
)
} The part left "TODO" above is the "interesting" part because Let me know if any of that needs to be clarified a bit more! |
Create a validation that
operationId
s inLink
objects refer toOperation
objects in the document that have the given ids. This should probably be an optional validation rather than a default one.Note that you should make changes to both the
OpenAPIKit30
andOpenAPIKit
modules (the changes will be mostly if not entirely identical).The text was updated successfully, but these errors were encountered: