laserninja opened a new pull request, #12859: URL: https://github.com/apache/gravitino/pull/12859
### What changes were proposed in this pull request? This PR adds the Python DTOs for Semantic Models and the bidirectional conversion to and from the public API types added in #12612, matching the Java wire contract established in #12606: - DTOs for every semantic type, plus `SemanticModelDefinitionDTO` and `SemanticModelDTO`. - `SemanticDTOUtils`-equivalent conversion helpers between API types and DTOs. - Custom serde for `AIContext` and `DataType`. The serialized form matches the Java DTOs exactly: - Ossie field names are used on the wire, so `Relationship.from_dataset()` serializes as `from`. - `DataType` serializes to its exact Ossie value, so `DataType.DECIMAL` becomes `"Decimal"`. - Dataset sources serialize as `NameIdentifier` objects with `namespace` and `name`. - Unset optional fields are omitted, matching Jackson's `NON_NULL` inclusion on the Java side. - AI context serializes either as a bare JSON string or as an object whose unknown properties are flattened alongside the standard ones and retained losslessly, matching `AIContextDTO`'s custom serializer. REST catalog operations and endpoint request and response handling are out of scope and are handled in #12614. ### Why are the changes needed? The Python API types added in #12612 need a serialization layer that matches the Java wire contract before the client can talk to the server. Depends on #12612. Fix: #12613 ### Does this PR introduce _any_ user-facing change? No. These are internal serialization types. ### How was this patch tested? Added 17 unit tests covering exact-JSON assertions for the minimal and complete definitions, JSON round-trips, both AI-context shapes, additional-property round-tripping through JSON, the Ossie datatype and field-name assertions listed above, and rejection of empty definitions and unknown datatypes. ``` ./gradlew :clients:client-python:test ``` -- 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]
