From 7fdfe9d1fd6ffd5b7584c8c684fb46c46b49e9ff Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Fri, 1 Sep 2023 11:02:17 +0300 Subject: [PATCH 1/2] Document the flags extension --- extensions/index.md | 1 + extensions/x-ms-enum-flags.md | 66 +++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 extensions/x-ms-enum-flags.md diff --git a/extensions/index.md b/extensions/index.md index 0649fc5d..de270dea 100644 --- a/extensions/index.md +++ b/extensions/index.md @@ -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| | diff --git a/extensions/x-ms-enum-flags.md b/extensions/x-ms-enum-flags.md new file mode 100644 index 00000000..f7b2a089 --- /dev/null +++ b/extensions/x-ms-enum-flags.md @@ -0,0 +1,66 @@ +# 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) | +| style | string | The serialization format of the selected enum values. Default is `simple` | + +#### `style` values + +Only `simple`(Simple style parameters defined by [RFC6570](https://spec.openapis.org/oas/v3.0.0#style-values)) is currently supported by Kiota. + +## 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 + style: + type: string + nullable: true + default: simple +``` + +## 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 + style: simple +``` + +Used by: (informational) + +* [Microsoft Kiota](https://aka.ms/kiota) From 07a3746a72481c5be2dab139e81f9d6911e65d11 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Mon, 4 Sep 2023 09:59:31 +0300 Subject: [PATCH 2/2] Drop style property for now --- extensions/x-ms-enum-flags.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/extensions/x-ms-enum-flags.md b/extensions/x-ms-enum-flags.md index f7b2a089..f65852d7 100644 --- a/extensions/x-ms-enum-flags.md +++ b/extensions/x-ms-enum-flags.md @@ -11,11 +11,6 @@ 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) | -| style | string | The serialization format of the selected enum values. Default is `simple` | - -#### `style` values - -Only `simple`(Simple style parameters defined by [RFC6570](https://spec.openapis.org/oas/v3.0.0#style-values)) is currently supported by Kiota. ## Schema @@ -27,10 +22,6 @@ properties: isFlags: type: boolean default: false - style: - type: string - nullable: true - default: simple ``` ## Example @@ -58,7 +49,6 @@ definitions: type: string x-ms-enum-flags: isFlags: true - style: simple ``` Used by: (informational)