Azure / azure-functions-openapi-extension

This extension provides an Azure Functions app with Open API capability for better discoverability to consuming parties
https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/
MIT License
375 stars 196 forks source link

.Net 8 Isolated Worker Azure Function v4 Swagger used by the UI is not consistent #673

Closed PremiumCEskew closed 3 weeks ago

PremiumCEskew commented 1 month ago

Working on getting an Azure Function app with an HttpTrigger working with OpenAPI 3.0 spec using .Net 8 isolated worker model. Everything is working great except the schemas being shown on the Swagger UI are inconsistent and don't always match what is on the swagger.json. All I'm doing to get the different schemas is refreshing the page. This is only happening once deployed to Azure and isn't happening locally.

Image

Image

"components": {
    "schemas": {
      "serviceRequest": {
        "type": "object",
        "properties": {
          "Id": {
            "type": "string"
          },
          "SiteId": {
            "type": "integer",
            "format": "int32"
          },
          "ClientId": {
            "type": "integer",
            "format": "int32"
          },
          "ActivitySubTypeId": {
            "type": "integer",
            "format": "int32"
          },
          "BeginDate": {
            "type": "string",
            "format": "date-time"
          },
          "EndDate": {
            "type": "string",
            "format": "date-time"
          },
          "Description": {
            "type": "string"
          },
          "Priority": {
            "type": "integer",
            "format": "int32"
          },
          "CompletionRequired": {
            "type": "boolean"
          },
          "ServiceRequestAttributes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/serviceRequestAttribute"
            }
          },
          "ProductSourceKey": {
            "type": "string"
          }
        }
      },
      "serviceRequestAttribute": {
        "type": "object",
        "properties": {
          "AttributeName": {
            "type": "string"
          },
          "AttributeValue": {
            "type": "string"
          },
          "AttributeDataType": {
            "type": "string"
          }
        }
      },
      "serviceRequestRequest": {
        "type": "object",
        "properties": {
          "TargetDate": {
            "type": "string",
            "format": "date-time"
          },
          "RequestContexts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/serviceRequestRequestContext"
            }
          }
        }
      },
      "serviceRequestRequestContext": {
        "type": "object",
        "properties": {
          "ServiceRequestGroupConfigurationId": {
            "type": "string"
          }
        }
      },
      "serviceRequestResponse": {
        "type": "object",
        "properties": {
          "ResponseContexts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/serviceRequestResponseContext"
            }
          }
        }
      },
      "serviceRequestResponseContext": {
        "type": "object",
        "properties": {
          "ServiceRequestGroupConfigurationId": {
            "type": "string"
          },
          "ServiceRequests": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/serviceRequest"
            }
          }
        }
      }
    }
PremiumCEskew commented 1 month ago

I used Developer tools in Chrome to look at network traffic and I can see that the swagger.json that is used to render the screen is sometimes missing the serviceRequest and serviceRequestAttribute components schemas. Any idea why that would be happening?

PremiumCEskew commented 3 weeks ago

I have since gone back and refactored my code to use Swashbuckle and am no longer having any issues. It seems that the OpenAPI extension is not fully compatible with .NET 8 just yet.