Closed peytondmurray closed 3 years ago
Currently namespaces are created automatically via https://github.com/Quansight/conda-store/blob/main/conda-store-server/conda_store_server/app.py#L223-L241. register_environment
is triggered by https://github.com/Quansight/conda-store/blob/main/conda-store-server/conda_store_server/server/views/api.py#L198 and then https://github.com/Quansight/conda-store/blob/main/conda-store-server/conda_store_server/api.py#L69. This looks like an endpoint that hasn't been testing since it will create the environment in the None
namespace. I don't think there should be an endpoint to create namespaces instead they should "always exist" and the server will create the namespace if it is ever referenced or needed. Though this does bring up that the /api/v1/specification/
is not complete and doesn't allow the user to specify namespace.
You can see the register namespace used within the UI here https://github.com/Quansight/conda-store/blob/main/conda-store-server/conda_store_server/server/views/ui.py#L42. Again this does expect that the namespace exists though. So this definitely needs to be fixed.
I'm proposing. Notice that specification here is in text form not required to be json (since it can be yaml). This is mainly to reduce the complexity on the client to do validation etc. Either way the specification is validated on the server end. This prevents the request from being deeply nested as well allowing for other targets e.g. formdata to supply this endpoint.
POST /api/v1/specifcation/
{
namespace: "<namespace-name>",
specification: "{...}",
}
Currently there is no endpoint for creating a namespace, but it would be really nice to have for continued efforts on Gator. Currently this blocks https://github.com/Quansight/conda-store/issues/132.