You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/openapi-core.md
+13-1Lines changed: 13 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -675,7 +675,7 @@ public class MyResponse
675
675
676
676
### `OpenApiPropertyAttribute` ###
677
677
678
-
This decorator provides model properties with description.
678
+
This decorator provides model properties with description, default value, nullable flag and deprecated flag.
679
679
680
680
```csharp
681
681
publicclassMyModel
@@ -685,6 +685,9 @@ public class MyModel
685
685
686
686
[OpenApiProperty(Nullable=true, Default="Hello World", Description="The text value")]
687
687
publicstringText { get; set; }
688
+
689
+
[OpenApiProperty(Default="Deprecated", Description="The deprecated text value", Deprecated=true)]
690
+
publicstringValue { get; set; }
688
691
}
689
692
690
693
// This will result in:
@@ -702,6 +705,12 @@ public class MyModel
702
705
// "nullable": true,
703
706
// "description": "The text value",
704
707
// "default": "Hello World"
708
+
// },
709
+
// "value": {
710
+
// "type": "string",
711
+
// "description": "The deprecated text value",
712
+
// "default": "Deprecated",
713
+
// "deprecated": true
705
714
// }
706
715
// }
707
716
// }
@@ -713,6 +722,7 @@ public class MyModel
713
722
*`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.
714
723
*`Default`: defines the default value of the property.
715
724
*`Description`: defines the description of the property.
725
+
*`Deprecated`: defines a value indicating whether the property is deprecated or not.
716
726
717
727
718
728
### `DisplayAttribute` ###
@@ -815,10 +825,12 @@ Properties decorated with the `MaxLengthAttribute` class impacts on either `Open
815
825
* If `OpenApiSchema.Type` is `array`: `OpenApiSchema.MaxItems`
816
826
* If `OpenApiSchema.Type` is NOT `array`: `OpenApiSchema.MaxLength`
817
827
828
+
818
829
### `RequiredAttribute` ###
819
830
820
831
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.
Some attribute classes from [System.Runtime.Serialization](https://docs.microsoft.com/dotnet/api/system.runtime.serialization) are supported for payload definition.
Copy file name to clipboardExpand all lines: docs/openapi.md
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,25 @@ If you set the `OpenApi__HideSwaggerUI` value to `true`, the Swagger UI page won
51
51
> **NOTE**: The default value for `OpenApi__HideSwaggerUI` is `false`.
52
52
53
53
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
+
54
73
### Configure OpenAPI Information ###
55
74
56
75
As a default, the OpenAPI document automatically generated provides a minimum set of information like:
0 commit comments