-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
Support Multiple Schema Validations #1066
base: main
Are you sure you want to change the base?
Support Multiple Schema Validations #1066
Conversation
internal/exec/validate_schema.go
Outdated
if len(validationErrors) == 0 { | ||
u.LogInfo(fmt.Sprintf("No Validation Errors found in %v using schema %v", yamlSource, customSchema)) | ||
} else { | ||
u.LogError(fmt.Errorf("Invalid YAML:")) | ||
for _, err := range validationErrors { | ||
u.LogError(fmt.Errorf("- %s\n", err)) | ||
} | ||
os.Exit(1) |
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.
Nothing new should ever use u.Log*
and instead should use the charmbracelet logger directly.
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.
https://github.com/cloudposse/atmos/blob/main/pkg/utils/log_utils.go
We use charmbracelet logger even if we use from utils. So, this should be fine
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.
No, we do that as a stop-gap measure until we update everything to use the charmbracelet logger methods directly.
All we can do with u.Log* is wrap errors, no semantic logging.
Please read up on semantic logging provided by charmbracelet and practice implementing it to understand the differences.
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.
cool will check that. Thanks for the update
pkg/validator/atmos_fetcher.go
Outdated
var ErrAtmosSchemaNotFound = errors.New("atmos schema not found") | ||
|
||
var atmosData = map[string][]byte{ | ||
"atmos://schema": []byte(atmosSchema), |
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.
Please see the ticket this is not right
pkg/validator/url_fetcher.go
Outdated
URL string | ||
} | ||
|
||
func (u *URLFetcher) Fetch() ([]byte, 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.
We should not write a new implementation. Everywhere else we use go-getter. At least we should be deliberate an out creating a new interface. We fetch URL's all over the place.
…estability-and' of https://github.com/cloudposse/atmos into feature/dev-3056-refactor-gogetter-utility-for-better-testability-and
…or-better-testability-and
…estability-and' of https://github.com/cloudposse/atmos into feature/dev-3056-refactor-gogetter-utility-for-better-testability-and
…or-better-testability-and
…or-better-testability-and
…or-better-testability-and
…or-better-testability-and
…estability-and' of https://github.com/cloudposse/atmos into feature/dev-3056-refactor-gogetter-utility-for-better-testability-and
…estability-and' of https://github.com/cloudposse/atmos into feature/dev-3056-refactor-gogetter-utility-for-better-testability-and
…-for-vendoring-and-atmos
…ing-and-atmos' of https://github.com/cloudposse/atmos into feature/dev-3030-implement-schema-validation-for-vendoring-and-atmos
…ing-and-atmos' of https://github.com/cloudposse/atmos into feature/dev-3030-implement-schema-validation-for-vendoring-and-atmos
4d3f699
to
248ad73
Compare
248ad73
to
8e2067a
Compare
internal/exec/validate_schema.go
Outdated
} | ||
} | ||
if customSchema == "" && yamlSource == "atmos.yaml" { | ||
customSchema = "atmos://schema" |
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.
Wrong URI. Atmos has many schemas, therefore we have to disambiguate them.
//go:embed schema/atmos-manifest.json | ||
var atmosSchema string |
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.
The issue here is there is an atmos stack schema, an atmos config schema, a vendor schema, a component schema, and a workflow schema.
This assumes we have one schema for Atmos, which we do not.
…ing-and-atmos' of https://github.com/cloudposse/atmos into feature/dev-3030-implement-schema-validation-for-vendoring-and-atmos
|
|
…ing-and-atmos' of https://github.com/cloudposse/atmos into feature/dev-3030-implement-schema-validation-for-vendoring-and-atmos
|
…-for-vendoring-and-atmos
|
Warning This PR exceeds the recommended limit of 1,000 lines.Large PRs are difficult to review and may be rejected due to their size. Please verify that this PR does not address multiple issues. |
…-for-vendoring-and-atmos
Why Draft
what
why
references