Skip to content

Expose strict or endpoint-controlled JSON request decoding #10

Description

@tylergannon

Problem

In v0.2.0, generated bindingJSON uses json.Unmarshal. Unknown fields are silently ignored, and malformed JSON is converted to a fixed adapter-level 400 before the service implementation runs.

That prevents an endpoint implementation from enforcing GitHub-specific request validation. For example, the installation-token endpoint needs to reject an unknown permission key and the validated contract returns 422 for malformed request bodies. Once the adapter has decoded *github.InstallationTokenOptions, the implementation can no longer distinguish an empty permissions object from one containing only unknown keys.

Requested behavior

Provide either:

  • a server option for strict decoding plus configurable binding-error mapping, or
  • a raw-body/decoder hook that lets the application own endpoint-specific validation before typed binding.

The default may remain permissive for compatibility. Add tests for unknown fields and malformed/multiple JSON values.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions