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

Require documentation of unions #740

Merged
merged 4 commits into from
Apr 29, 2024
Merged

Require documentation of unions #740

merged 4 commits into from
Apr 29, 2024

Conversation

tjprescott
Copy link
Member

@tjprescott tjprescott commented Apr 25, 2024

Closes #516 .

This PR:

  • Exempts discriminator unions from requiring documentation
  • Requires documentation of the union itself
  • Requires documentation of named union variants, but not symbolic variants

REST API Specs
Violations: 27
Azure/azure-rest-api-specs#28849

@azure-sdk
Copy link
Collaborator

azure-sdk commented Apr 25, 2024

All changed packages have been documented.

  • @azure-tools/typespec-azure-core
Show changes

@azure-tools/typespec-azure-core - fix ✏️

Require documentation on most unions.

@azure-sdk
Copy link
Collaborator

@tjprescott
Copy link
Member Author

tjprescott commented Apr 25, 2024

For reviewers, this currently is the minimal passing behavior:

/** Describes the kind of Pet. */
union PetStyle1 {
  /** Kitty */
  Cat: "cat",
  /** Doggy */
  Dog: "dog",
  string
}

/** Describes the kind of Pet */
union PetStyle2 {
  "cat",
  "dog",
  string
}

The logic only requires documentation for named variants. string doesn't require it because it's just a symbol, and any documentation added is ignored by the Autorest emitter anyhow. However, in the second style, the emitter basically converts this to the same Swagger as the first, so should documentation be required here as well?

Updated the logic to require documentation even on string literal variants.

@tjprescott tjprescott added this pull request to the merge queue Apr 29, 2024
Merged via the queue into main with commit 0d70108 Apr 29, 2024
21 checks passed
@tjprescott tjprescott deleted the tsp/unionDocs branch April 29, 2024 16:04
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

Successfully merging this pull request may close these issues.

Lint for enum doc should be applied to union as enum
3 participants