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

$withUpdateableProperties does not make updatable properties optional. Which either it or the openapi3 emitter should. #605

Open
johanste opened this issue Jun 8, 2022 · 2 comments
Milestone

Comments

@johanste
Copy link
Contributor

johanste commented Jun 8, 2022

import "@cadl-lang/rest";

model Something {
  @key
  id: string;

  thisIsUpdatable: string;
}

@Cadl.Http.post op stuff(properties: UpdateableProperties<Something>): Something;

=>

"schemas": {
      "UpdateableProperties_Something": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "thisIsUpdatable": {
            "type": "string"
          }
        },
        "description": "The template for adding updateable properties.",
        "required": [
          "id",
          "thisIsUpdatable" // <-- this should not be required
        ]

Playground Link

@ghost ghost added the Needs Triage label Jun 8, 2022
@markcowl
Copy link
Contributor

markcowl commented Jun 9, 2022

There is a separate template for optional properties. This gets used in patch bodies for ARM: https://github.com/Azure/cadl-azure/blob/main/packages/cadl-azure-resource-manager/lib/arm.cadl#L92

@markcowl
Copy link
Contributor

@johanste can we close this?

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

3 participants