-
Notifications
You must be signed in to change notification settings - Fork 8
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
fix: skip validation on external req/resp types #1304
Conversation
We don't have access to the full schema at this point, so we can't validate that external types exist
711c898
to
3fb2f6e
Compare
bodySym := scopes.ResolveType(fieldType) | ||
if bodySym == nil { | ||
merr = append(merr, errorf(resp, "ingress verb %s: couldn't resolve %s body type %s", n.Name, reqOrResp, fieldType)) | ||
merr = append(merr, errorf(r, "ingress verb %s: couldn't resolve %s body type %s", n.Name, reqOrResp, fieldType)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the issue where initial deploy failed: 14:3-3: ingress verb getQuote:
is returned as an error. This was because of a typo that used resp
instead of r
for the errorf(
call
if ref, err := ParseRef(fieldType.String()); err == nil { | ||
if ref.Module != "" && ref.Module != module.Name { | ||
return // ignores references to other modules. | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This introduces logic to not validate resp body types for external modules since we don't have the full schema here, just a single module. This follows the comments for ValidateModule
// ValidateModule performs the subset of semantic validation possible on a single module.
//
// It ignores references to other modules.
func ValidateModule(module *Module) error {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this get validated in ValidateSchema
instead now? I don't see that in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I believe that code is here:
https://github.com/TBD54566975/ftl/blob/main/backend/schema/validate.go#L137
and tested here:
https://github.com/TBD54566975/ftl/blob/main/backend/schema/schema_test.go#L211-L214
We don't have access to the full schema at this point, so we can't validate that external types exist
Fixes #1298