Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@required trait not supported on input and output types of an operation #182

Open
aashokgithub opened this issue Sep 27, 2023 · 1 comment

Comments

@aashokgithub
Copy link

aashokgithub commented Sep 27, 2023

Lets assume that we have an operation as shown below

@http(code: 200, method: "POST", uri: "/test_operation")
operation TestOperation {
    input := {
        @required
        test1: String
        @required
        test2: String
    }
    output := {
       @required
       test3: String
    }
}

The TestOperationInput and TestOperationOutput that are generated will generate filed which are Optional[String] even if they are annotated with @required

This happens only with input and output of a operation

@JordonPhillips
Copy link
Contributor

That's because inputs and outputs with the @input / @output traits treat top-level members as optional. See here for more information on that. Using the inline input and output shape definition syntax automatically applies those traits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants