Skip to content

Commit 11d8d1a

Browse files
committed
Update docs
1 parent e366101 commit 11d8d1a

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

docs/openapi-core.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ public class MyResponse
675675

676676
### `OpenApiPropertyAttribute` ###
677677

678-
This decorator provides model properties with description.
678+
This decorator provides model properties with description, default value, nullable flag and deprecated flag.
679679

680680
```csharp
681681
public class MyModel
@@ -685,6 +685,9 @@ public class MyModel
685685

686686
[OpenApiProperty(Nullable = true, Default = "Hello World", Description = "The text value")]
687687
public string Text { get; set; }
688+
689+
[OpenApiProperty(Default = "Deprecated", Description = "The deprecated text value", Deprecated = true)]
690+
public string Value { get; set; }
688691
}
689692

690693
// This will result in:
@@ -702,6 +705,12 @@ public class MyModel
702705
// "nullable": true,
703706
// "description": "The text value",
704707
// "default": "Hello World"
708+
// },
709+
// "value": {
710+
// "type": "string",
711+
// "description": "The deprecated text value",
712+
// "default": "Deprecated",
713+
// "deprecated": true
705714
// }
706715
// }
707716
// }
@@ -713,6 +722,7 @@ public class MyModel
713722
* `Nullable`: defines a value indicating whether the property is nullable or not. This value takes precedence regardless the property itself is nullable value type or not.
714723
* `Default`: defines the default value of the property.
715724
* `Description`: defines the description of the property.
725+
* `Deprecated`: defines a value indicating whether the property is deprecated or not.
716726

717727

718728
### `DisplayAttribute` ###
@@ -815,10 +825,12 @@ Properties decorated with the `MaxLengthAttribute` class impacts on either `Open
815825
* If `OpenApiSchema.Type` is `array`: `OpenApiSchema.MaxItems`
816826
* If `OpenApiSchema.Type` is NOT `array`: `OpenApiSchema.MaxLength`
817827

828+
818829
### `RequiredAttribute` ###
819830

820831
Properties decorated with the `RequiredAttribute` class impacts on the `OpenApiSchema.Required` value of parent schema. In addition to this, if `RequiredAttribute.AllowEmptyString` is `false` and the property is of type `string`, the `OpenApiSchema.MinLength` will be set to 1, if a larger value has not already been set.
821832

833+
822834
## Supported System.Runtime.Serialization Decorators ##
823835

824836
Some attribute classes from [System.Runtime.Serialization](https://docs.microsoft.com/dotnet/api/system.runtime.serialization) are supported for payload definition.

docs/openapi.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,25 @@ If you set the `OpenApi__HideSwaggerUI` value to `true`, the Swagger UI page won
5151
> **NOTE**: The default value for `OpenApi__HideSwaggerUI` is `false`.
5252
5353

54+
### Configure OpenAPI Document Visibility ###
55+
56+
> **NOTE**: Currently, the out-of-process worker model doesn't support hiding OpenAPI document. The following configurations are only applicable to the in-process worker extension.
57+
58+
You may want to only enable the OpenAPI document page during the development time, and disable the page when publishing it to Azure. You can configure an environment variable to enable/disable the OpenAPI document page. Here's the sample `local.settings.json` file. The other values are omitted for brevity.
59+
60+
```json
61+
{
62+
"Values": {
63+
"OpenApi__HideDocument": "false"
64+
}
65+
}
66+
```
67+
68+
If you set the `OpenApi__HideDocument` value to `true`, the OpenAPI page won't be showing up, and you will see the 404 error. Make sure that, if you set the `OpenApi__HideDocument` value to `true`, it won't show the Swagger UI page either, regardless the `OpenApi__HideSwaggerUI` value is `true` or `false`.
69+
70+
> **NOTE**: The default value for `OpenApi__HideDocument` is `false`.
71+
72+
5473
### Configure OpenAPI Information ###
5574

5675
As a default, the OpenAPI document automatically generated provides a minimum set of information like:

0 commit comments

Comments
 (0)