Skip to content

Document the x-ms-enum-flags extension #8

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

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions extensions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
|[x-ms-client-name](https://github.com/Azure/autorest/blob/main/docs/extensions/readme.md#x-ms-client-name) | allows control over identifier names used in client-side code generation for parameters and schema properties. |AutoRest| |
|[x-ms-code-generation-settings](https://github.com/Azure/autorest/blob/main/docs/extensions/readme.md#x-ms-code-generation-settings) | enables passing code generation settings via OpenAPI document |Autorest| |
|[x-ms-deprecation](x-ms-deprecation.md)| Provides additional information about a deprecated endpoint, schema, property, etc... | Kiota | |
|[x-ms-enum-flags](x-ms-enum-flags.md)| Provides information about whether an enum is bitwise(flagged) and the expected serialization format | Kiota | |
|[x-ms-external](https://github.com/Azure/autorest/blob/main/docs/extensions/readme.md#x-ms-external) | allows specific Definition Objects to be excluded from code generation |AutoRest| |
|[x-ms-info-kiota](x-kiota-info.md)| Provides configuration information to the Kiota API client code generator| Kiota |
|[x-ms-mutability](https://github.com/Azure/autorest/blob/main/docs/extensions/readme.md#x-ms-mutability) | provides insight to Autorest on how to generate code. It doesn't alter the modeling of what is actually sent on the wire. |AutoRest| |
Expand Down
56 changes: 56 additions & 0 deletions extensions/x-ms-enum-flags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# OpenAPI Extension: x-ms-enums-flags

This extension enables API providers to specify an enum as a bitwise(flagged) enum as well as the format of serialization of the multiple selected values.

## x-ms-enums-flags object

### Properties

Properties are optional unless specified otherwise.

| name | type | description |
|---|---|---|
| isFlags | boolean | Whether or not the enum is bitwise(flagged). Default is `false`(same as not specifying the extension) |

## Schema

Below is a yaml representation of the JSON Schema that defines the shape of the `x-ms-deprecation` object.

```yaml
type: object
properties:
isFlags:
type: boolean
default: false
```

## Example

```yaml
openapi: 3.0.3
info:
title: OData Service for namespace microsoft.graph
description: This OData service is located at https://graph.microsoft.com/v1.0
version: 1.0.1
paths:
'/foo'
operations:
get:
servers:
- url: https://graph.microsoft.com/v1.0
definitions:
Microsoft.Graph.Feature:
title: Feature
enum:
- Feature1
- Feature2
- Feature3
- Feature4
type: string
x-ms-enum-flags:
isFlags: true
```

Used by: (informational)

* [Microsoft Kiota](https://aka.ms/kiota)