Skip to content

Add a warning of extra / missing fields when doing a request. #217

@lakardion

Description

@lakardion

Whenever a request is made. It would be nice to have a good warning when there are fields missing/mismatching from what we declared as expected

Possible implementation

src/utils/response.ts

const compareKeys = (expectedObject: object, subjectObject: object) => {
  const expected = new Set(Object.keys(expectedObject))
  const subject = new Set(Object.keys(subjectObject))
  return {
    missing: Array.from(expected.difference(subject)),
    extra: Array.from(subject.difference(expected)),
  }
}

I think there should be some checks to do since we have the snake and camelCase parsing which might or might not be involved at this point

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions