dengc367 opened a new pull request, #14365:
URL: https://github.com/apache/gravitino/pull/14365

   ### What changes are proposed in this pull request?
   
   **Stacked on #14347.** The first four commits in this branch belong to 
#14347 (API, Ossie converter, storage); only the last six are new here. 
Reviewing those four is #14347's job — once it merges this PR shrinks to 
roughly 54 files.
   
   This slice adds the REST layer, both clients and the user documentation for 
the metalake-level ontology.
   
   **REST** (`server`, `common`)
   
   - `/api/metalakes/{metalake}/ontologies`: `GET` for names or `?details=true` 
for the complete ontologies, `POST` to create, and `GET`, `PUT` and `DELETE` on 
`/{ontology}`.
   - `PUT` takes an ordered `{"updates": [...]}` batch, applied atomically, 
whose entries are discriminated by `@type`: `rename`, `updateComment`, 
`setProperty`, `removeProperty`, `replaceDefinition`, `updateStatus`.
   - `OntologyDTO` and the definition, concept, relationship and role DTOs; the 
create, update and updates requests; the single and list responses.
   - `OntologyDispatcher` / `OntologyOperationDispatcher` over the entity 
store, wired into `GravitinoEnv` and `GravitinoServer`.
   - `OntologyExceptionHandler`, mapping the ontology exceptions onto the 
shared error responses (not found, already exists, illegal argument, not in 
use).
   - `docs/open-api/ontologies.yaml`, referenced from 
`docs/open-api/openapi.yaml` and validated by `:docs:build`.
   
   **Java client**: `GravitinoMetalake implements SupportsOntologies` with the 
six operations, a change-to-update-request converter, and an ontology error 
handler.
   
   **Python client**: an `api/ontology` model layer, DTOs, requests, an error 
handler and the six metalake methods.
   
   **Docs**: `docs/ontologies.md`, linked from `docs/index.md`.
   
   ### Why are the changes needed?
   
   The API and the store from #14347 are not reachable without a transport and 
a client. This slice exposes the ontology through the same REST conventions as 
the other metalake-level metadata objects, so a caller can create a vocabulary, 
iterate on it while it is `DRAFT`, publish it, and read the published version — 
and so the Java and Python clients can drive that loop.
   
   Two limits are stated in the documentation rather than left implicit:
   
   - Ossie import and export exist on the Java API 
(`OntologyOperations.importOssieDocument` / `exportOssieDocument`) but have no 
REST endpoint yet;
   - `MANAGE_ONTOLOGY` / `USE_ONTOLOGY` are specified but not yet part of the 
authorization model, so until they land, writes require metalake ownership and 
reads require metalake access, and drafts are not hidden from readers.
   
   Fixes #14309
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, additively: five new REST endpoints under 
`/api/metalakes/{metalake}/ontologies`, new methods on the Java and Python 
metalake clients, and a new documentation page. No configuration key is added.
   
   ### How was this patch tested?
   
   All runs use JDK 17 after `spotlessApply`.
   
   | Layer | Tests |
   |---|---|
   | `TestOntologyOperations` — every endpoint across the wire, including all 
six update types, plus 404 and 409 paths | 7 |
   | `TestOntologyOperationDispatcher` — list, create, get, alter, delete and 
the error paths against a mocked entity store | 15 |
   | `TestOntologyClient` — Java client against a mocked server | 13 |
   | Python client unit tests | 23, within the full 1283-test suite |
   
   ```
   JAVA_HOME=<jdk17> ./gradlew \
     :server:test --tests "*TestOntology*" \
     :core:test --tests 
"org.apache.gravitino.ontology.TestOntologyOperationDispatcher" \
     :clients:client-java:test --tests "*TestOntologyClient" \
     :docs:build -PskipITs
   BUILD SUCCESSFUL
   ```
   
   The full `:clients:client-java:test` suite (377 tests) and the full Python 
unit suite (1283 tests) also pass, and `:docs:build` validates the OpenAPI spec.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to