ansys / ansys/pyacp

Design API for polymorphic containers

Open
#7 2 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
Python
Stars
9
Forks
1
Avg merge
2d 9h
Merged PRs (30d)
10

Description

For some elements in the ACP tree, a single "collection" can hold items of different types. For example, a `ModelingGroup` can contain `ModelingPly`, `InterfaceLayer`, and `ButtJointSequence`. In this case, the order of entries matters, so it's not sufficient to put them into separate collections.

Recap of team discussion:

At the API level, we will expose two different services:
- A "generic" service which can return the basic information (incl. type information) for all entities in a collection. This service can be used to determine the global ordering.
- A specific service for each of the types contained within the collection. This ensures decoupling between the internals of each of the types. Otherwise, we would have to implement mixed / polymorphic message types, which is clunky in protobuf.

For the `ModelingGroup` example, we could have collections `models/*/modeling_groups/*/sequence_entities` (generic service), and `models/*/modeling_groups/*/modeling_plies` , `models/*/modeling_groups/*/interface_layers`, `models/*/modeling_groups/*/butt_joint_sequences`.

At the high-level Python API level, we can still instantiate the return values of a `List` on the generic service as the specific types. The specific type implementations then take care of dispatching to the correct endpoint, so the split across two services should not affect the end user.

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by locating the existing collection services and the high-level Python API for ModelingGroup and its related entity types, then compare them with the proposed generic sequence_entities and type-specific endpoints. Done means the API design is agreed and the generic listing preserves ordering while dispatching to the specific types.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.