Skip to content

Update validation schema#32

Merged
jalvarezit merged 8 commits into
mainfrom
feat/update-auth-validation
Apr 17, 2026
Merged

Update validation schema#32
jalvarezit merged 8 commits into
mainfrom
feat/update-auth-validation

Conversation

@jalvarezit
Copy link
Copy Markdown
Contributor

@jalvarezit jalvarezit commented Mar 20, 2026

@jalvarezit jalvarezit changed the title Update validation schema to include 'url' and adjust required fi… Update validation schema Mar 20, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the registry validation/mapping to support a url field in addition to the existing registry field, and renames internal usage from RegistryHost to Url.

Changes:

  • Extend the JSON schema to accept url as an alternative to registry.
  • Rename the Registry struct field from RegistryHost to Url and update call sites/tests accordingly.
  • Add custom YAML/JSON unmarshaling on Registry to accept either registry or url.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
validations.go Schema updated to accept url or registry via oneOf.
types.go RegistryHost replaced with Url; adds custom YAML/JSON unmarshal logic.
io.go Switch duplicate detection / lookup to use registry.Url; adds skip logic for empty auth_strategy.
multilogin.go Use registry.Url for Azure/generic/ghcr auth flows.
validations_test.go Update schema validation tests to use Url field.
io_test.go Update parser tests to assert Url field.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread io.go Outdated
Comment thread types.go
Comment thread types.go Outdated
Comment thread io.go Outdated
Comment thread types.go
Comment thread validations_test.go
Comment thread io_test.go Outdated
Comment thread io.go Outdated
Comment thread validations.go Outdated
Comment thread validations.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread validations.go Outdated
Comment thread io_test.go
Comment on lines 8 to 13
func TestRegistriesParser(t *testing.T) {

registries := parseRegistriesFromDir("./test/fixtures/registries")

fmt.Printf("Registries: %v\n", registries[0].RegistryHost)
fmt.Printf("Registries: %v\n", registries[0].Url)

Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

Tests only cover parsing legacy registry: fixtures. Since Registry now supports url: as well (and intends to forbid specifying both), add coverage for a fixture or inline YAML using url: and for the “both keys present” error case so this migration behavior is protected.

Copilot uses AI. Check for mistakes.
Comment thread types.go
Comment on lines +23 to +27
if reg, ok := aux["registry"].(string); ok {
r.Url = reg
} else if url, ok := aux["url"].(string); ok {
r.Url = url
}
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

UnmarshalYAML accepts both registry and url, but if both keys are present it silently prefers registry and discards url. That means the schema’s oneOf mutual-exclusion rule won’t actually be enforced (the validator never sees both). If the intent is “exactly one of these keys”, detect this during YAML unmarshal and return an error when both are set.

Copilot uses AI. Check for mistakes.
Comment thread types.go
Comment thread types.go
@jalvarezit jalvarezit merged commit d85dd54 into main Apr 17, 2026
2 checks passed
@jalvarezit jalvarezit deleted the feat/update-auth-validation branch April 17, 2026 13:05
jalvarezit added a commit that referenced this pull request Apr 17, 2026
* fix: update validation schema to include 'url' and adjust required fields

* refactor: update registry handling to use 'url' instead of 'registryHost' and adjust validation schema

* fix: update registry validation to use 'url' instead of 'registry' and adjust required fields

* update oauth oci

* fix: update registry field to use 'RegistryHost' instead of 'Registry' in types and tests

* fix: correct formatting in validation schema definition

* fix: update validation schema to remove unnecessary required fields

* fix: update validation schema to allow null values for image_types and base_paths
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.

3 participants