Skip to content

Commit

Permalink
feat: log schema (#8)
Browse files Browse the repository at this point in the history
* feat: log schema

* Update internal/schema/schema.go

Co-authored-by: Dannick B. Senss <44579430+Bsenss6@users.noreply.github.com>

---------

Co-authored-by: Dannick B. Senss <44579430+Bsenss6@users.noreply.github.com>
  • Loading branch information
mariloufarmer and Bsenss6 authored Oct 24, 2024
1 parent 0af9216 commit 40d7890
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ func ExtractReadOnlyTraits(url string) (map[string]bool, error) {
return nil, err
}
if resp.StatusCode < 200 || resp.StatusCode > 299 {
log.Error().Msg(fmt.Sprintf("Failed to get schema (%d) with body: %s", resp.StatusCode, string(body[:])))
return nil, fmt.Errorf("%d: %s", resp.StatusCode, string(body))
}

// Extract the traits
log.Info().Msg("Extracting traits...")
var schema map[string]any
if err := json.Unmarshal(body, &schema); err != nil {
return nil, err
Expand All @@ -38,6 +40,7 @@ func ExtractReadOnlyTraits(url string) (map[string]bool, error) {
return nil, errors.New("traits object missing from schema")
}

log.Info().Msg(fmt.Sprintf("Traits: %+v", traits))
// Extract the readonly state for every trait
traitStates := make(map[string]bool, len(traits))
for trait, rawValues := range traits {
Expand Down

0 comments on commit 40d7890

Please sign in to comment.