Skip to content
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

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

wesbillman
Copy link
Collaborator

We don't have access to the full schema at this point, so we can't validate that external types exist

Fixes #1298

@wesbillman wesbillman requested a review from a team as a code owner April 18, 2024 18:25
@wesbillman wesbillman requested review from worstell and removed request for a team April 18, 2024 18:25
@alecthomas alecthomas mentioned this pull request Apr 18, 2024
We don't have access to the full schema at this point, so we can't validate that external types exist
@wesbillman wesbillman force-pushed the skip-validation-on-external-reqresp-types branch from 711c898 to 3fb2f6e Compare April 18, 2024 18:28
@wesbillman wesbillman merged commit b8e6065 into main Apr 18, 2024
11 checks passed
@wesbillman wesbillman deleted the skip-validation-on-external-reqresp-types branch April 18, 2024 18:41
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))
Copy link
Collaborator Author

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

Comment on lines +516 to +520
if ref, err := ParseRef(fieldType.String()); err == nil {
if ref.Module != "" && ref.Module != module.Name {
return // ignores references to other modules.
}
}
Copy link
Collaborator Author

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 {

Copy link
Collaborator

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.

Copy link
Collaborator Author

@wesbillman wesbillman Apr 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Three bugs that I don't know how to reproduce or fix
3 participants