Skip to content

Commit 2985b96

Browse files
authored
Merge pull request #8 from andrueastman/andrueastman/enum-flags
Document the `x-ms-enum-flags` extension
2 parents f0e2abd + 969cfee commit 2985b96

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

extensions/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
|[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| |
99
|[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| |
1010
|[x-ms-deprecation](x-ms-deprecation.md)| Provides additional information about a deprecated endpoint, schema, property, etc... | Kiota | |
11+
|[x-ms-enum-flags](x-ms-enum-flags.md)| Provides information about whether an enum is bitwise(flagged) and the expected serialization format | Kiota | |
1112
|[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| |
1213
|[x-ms-info-kiota](x-kiota-info.md)| Provides configuration information to the Kiota API client code generator| Kiota |
1314
|[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| |

extensions/x-ms-enum-flags.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# OpenAPI Extension: x-ms-enums-flags
2+
3+
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.
4+
5+
## x-ms-enums-flags object
6+
7+
### Properties
8+
9+
Properties are optional unless specified otherwise.
10+
11+
| name | type | description |
12+
|---|---|---|
13+
| isFlags | boolean | Whether or not the enum is bitwise(flagged). Default is `false`(same as not specifying the extension) |
14+
15+
## Schema
16+
17+
Below is a yaml representation of the JSON Schema that defines the shape of the `x-ms-deprecation` object.
18+
19+
```yaml
20+
type: object
21+
properties:
22+
isFlags:
23+
type: boolean
24+
default: false
25+
```
26+
27+
## Example
28+
29+
```yaml
30+
openapi: 3.0.3
31+
info:
32+
title: OData Service for namespace microsoft.graph
33+
description: This OData service is located at https://graph.microsoft.com/v1.0
34+
version: 1.0.1
35+
paths:
36+
'/foo'
37+
operations:
38+
get:
39+
servers:
40+
- url: https://graph.microsoft.com/v1.0
41+
definitions:
42+
Microsoft.Graph.Feature:
43+
title: Feature
44+
enum:
45+
- Feature1
46+
- Feature2
47+
- Feature3
48+
- Feature4
49+
type: string
50+
x-ms-enum-flags:
51+
isFlags: true
52+
```
53+
54+
Used by: (informational)
55+
56+
* [Microsoft Kiota](https://aka.ms/kiota)

0 commit comments

Comments
 (0)