data-api-builder icon indicating copy to clipboard operation
data-api-builder copied to clipboard

[Enhancement]: Support multiple folders in `rest.path`.

Open JerryNixon opened this issue 2 years ago • 2 comments

What happened?

Right now, an entity supports this configuration:

      "rest": {
        "enabled": true,
        "path": "/customers"
      },

But it does not support a subfolder like this:

      "rest": {
        "enabled": true,
        "path": "/jerry/customers"
      },

Note the jerry folder.

The value of this approach would be to let customers design the structure of their endpoints into folders. In simple examples with 1 or 10 endpoints, this may not seem apparent. But introduce 20 or 100 or even 1,000 endpoints and grouping them like this makes them far more sensible.

Note: @kliszaq https://github.com/Azure/data-api-builder/issues/1638#issuecomment-1733478050

Version

Future

What database are you using?

Azure SQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

REST

Relevant log output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

JerryNixon avatar Oct 10 '23 22:10 JerryNixon

Current behavior

fail: Azure.DataApiBuilder.Service.Startup[0]
      Unable to complete runtime initialization. Refer to exception for error details.
      Azure.DataApiBuilder.Service.Exceptions.DataApiBuilderException: The rest path: jerry/customers for entity: Customers contains one or more reserved characters.
         at Azure.DataApiBuilder.Core.Configurations.RuntimeConfigValidator.ValidateRestPathSettingsForEntity(String entityName, String pathForEntity)
         at Azure.DataApiBuilder.Core.Configurations.RuntimeConfigValidator.ValidateEntityConfiguration(RuntimeConfig runtimeConfig)
         at Azure.DataApiBuilder.Core.Configurations.RuntimeConfigValidator.ValidateConfig()
         at Azure.DataApiBuilder.Service.Startup.PerformOnConfigChangeAsync(IApplicationBuilder app)
fail: Azure.DataApiBuilder.Service.Startup[0]
      Exiting the runtime engine...

JerryNixon avatar Oct 10 '23 22:10 JerryNixon

This tweak would facilitate exposing identical endpoints from both the DAB CLI and the SWA CLI. E.g., specify "path": "/data-api/rest" in dab-config.Development.json file and "path": "/rest" in the staticwebapp.database.config.json file. Note that "path": "data-api%2Frest" isn't a workaround.

CalvinQuark avatar Oct 13 '23 15:10 CalvinQuark