Skip to content

SystemOne Go DTO: one-sided Noul criteria compatibility and required numeric field presence #859

Description

@CodeyCoo

Using github.com/OpenRouterTeam/go-sdk v0.8.31 with SystemOne.Create, I found two DTO/contract questions for Jev.

1. One-sided Noul criteria

The TypeSafe System One API permits criteria descriptions for true and false to be omitted independently. Is OpenRouter's /api/v1/systemone intended to accept a criteria object containing only one side? The Go SDK's DecisionsNoulQuestionCriteria has non-pointer True and False union fields, and its generated docs mark both required. If a caller sets only True, json.Marshal(components.DecisionsRequest{...}) fails with:

json: error calling MarshalJSON for type *components.DecisionsNoulQuestionCriteria: json: error calling MarshalJSON for type *components.False: could not marshal union type False: all fields are null

If the endpoint accepts one-sided criteria, could the Go DTO represent the absent side? If the endpoint intentionally requires both, could the System One compatibility documentation state that difference from TypeSafe?

2. Required numeric response fields lose presence information

DecisionsNoulAnswer.Noul and DecisionsScoreAnswer.Score are float64 fields. The generated UnmarshalJSON methods accept responses missing these fields and leave them as 0. For example, unmarshalling both {"type":"noul"} and {"type":"noul","noul":0} into components.DecisionsNoulAnswer produces identical values; likewise for score. The adapter cannot distinguish a malformed response from a legitimate zero.

Could the decoder reject missing required fields or expose presence information (for example, pointers or required-field validation)?

This was reproduced against v0.8.31 with Go 1.27.0; no API key or live request is involved.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions