Azure / data-api-builder

Data API builder provides modern REST and GraphQL endpoints to your Azure Databases and on-prem stores.
https://aka.ms/dab/docs
MIT License
787 stars 142 forks source link

[Enhancement]: Complete our OpenAPI implementation #2276

Open JerryNixon opened 1 week ago

JerryNixon commented 1 week ago

There are several issues around OpenAPI necessary to consider it fully implemented.

1. Obey "request-body-strict"

Today, the openAPI includes object types that are not required by the endpoint. See #1838

2. Export role-specific OpenAPI document in the CLI

Today, the OpenAPI defaults to every CRUD operation, even those not enabled or allowed.

Support syntax like: dab export --openapi:<role-name>

3. Allow role-specific OpenAPI documents in the configuration

Today, the only OpenAPI is the default OpenAPI, this provides custom documents without engine overhead.

{
  "$schema": "https://github.com/Azure/data-api-builder/releases/download/v1.1.7/dab.draft.schema.json",
  "openapi": { // new
    "default-role": "blank", (<role-name>, string, required)
    "files": {
      "blank": "blank.openapi.json",  (name:<role-name>, value:<file-path>)
      "anonymous": "anonymous.openapi.json",
      "special": "special.openapi.json"
    }
  }
}

4. Support role-name in OpenAPI endpoint

Today, the OpenAPI endpoint returns only one document. A custom route can support specific roles.

Support syntax like: https://server/api/openapi/anonymous

Allow the old syntax https://server/api/openapi to indicate default.

5. Include object descriptions in the OpenAPI document.

Today, these values are not included - neither are they available through the configuration. See #2262

Benjiiim commented 4 days ago

Great stuff! Thanks

I don't know if it makes sense to add the following which is already covered in #1771 ?

Honor methods property for entities backed by tables/views Today, Open API documentation includes methods that are not listed in the rest.methods property of the entity. Honoring the rest.methods property would allow the simplification of the Open API endpoint.