mindersec / minder

Software Supply Chain Security Platform
https://minder-docs.stacklok.dev/
Apache License 2.0
295 stars 43 forks source link

Set "REQUIRED" field behaviour flag for fields in minder protos #4952

Open eleftherias opened 2 weeks ago

eleftherias commented 2 weeks ago

For clients using the openAPI spec, it would be useful to know which input fields are required and which output fields are non-nullable.

We can use the REQUIRED field_behaviour flag to annotate these types of fields.

For example by setting the behaviour to REQUIRED, the typescipt generated field is non-optional:

message Provider {
    // name is the name of the provider.
    string name = 1 [
        (google.api.field_behavior) = REQUIRED
    ];

produces the following typescipt type (note that it does not have a ? marking it as optional):

type v1Provider = {
    /**
     * name is the name of the provider.
     */
    name: string;
}

This task involves finding all the fields that are both required as input AND non-nullable as output.

⚠️ Note that we reuse several messages as inputs and outputs. We can only set the REQUIRED flag on fields that are both required on input AND never null on output. If a field is required on input, but may be null on output, we cannot use this flag.

eleftherias commented 4 days ago

I'm starting from the top of the minder.proto file and working my way through all the messages. I'll list all the messages that are completed here to avoid any duplicate work. So far a PR has been created for:

eleftherias commented 4 days ago

PR created for:

eleftherias commented 3 days ago

PR created for:

eleftherias commented 3 days ago

PR created for: