superposition icon indicating copy to clipboard operation
superposition copied to clipboard

feat: support type templates

Open Datron opened this issue 1 year ago • 2 comments

Problem

Users want to create and use their own types in default configs and overrides. Some teams like NY want to overwrite the default types to support null values

Solution

https://github.com/juspay/superposition/discussions/52

API changes

Name Method URL request response
List Type GET /types None [{"created_at":"2024-05-13T12:02:02.030601","created_by":"[email protected]","display_name":"Number","id":"ed8c06e7-655b-4805-bd98-cd47f3a90cfc","last_modified":"2024-05-13T12:02:02.030601","type_name":"number","type_schema":{"type":"number"}},{"created_at":"2024-05-13T12:02:02.030601","created_by":"[email protected]","display_name":"Decimal","id":"c7b88aa0-dd0b-4b8d-9492-f2bb8701f8b9","last_modified":"2024-05-13T12:02:02.030601","type_name":"number","type_schema":{"type":"number"}},{"created_at":"2024-05-13T12:02:02.030601","created_by":"[email protected]","display_name":"Boolean","id":"16abae89-9fbd-488f-ac8b-d9ebdc8fae23","last_modified":"2024-05-13T12:02:02.030601","type_name":"boolean","type_schema":{"type":"boolean"}},{"created_at":"2024-05-13T12:02:02.030601","created_by":"[email protected]","display_name":"String (Enum)","id":"eed97c33-4a0d-4ab7-a7fe-8e1408f48e4f","last_modified":"2024-05-13T12:02:02.030601","type_name":"enum","type_schema":{"enum":"$replacement","type":"string"}},{"created_at":"2024-05-13T12:02:02.030601","created_by":"[email protected]","display_name":"String (Regex)","id":"2e5cd6a1-8b28-440a-83b1-3d0fce590340","last_modified":"2024-05-13T12:02:02.030601","type_name":"pattern","type_schema":{"pattern":"$replacement","type":"string"}}]
Create Type PUT /types { "type_schema": {"type": "integer"}, "display_name": "Integer", "type_name": "i16"} {"message": "custom type created successfully"}
Update Type PUT /types { "type_schema": {"type": "integer"}, "display_name": "Integer", "type_name": "i32"} {"message": "custom type created successfully"}
Delete Type DELETE /types/{id} None {"message": "deleted custom type"}

https://github.com/juspay/superposition/assets/15166178/5c4d9dba-3c19-4125-8518-d76622a96a9a

https://github.com/juspay/superposition/assets/15166178/9725b132-6601-4a7b-8471-415517f8c56b

https://github.com/juspay/superposition/assets/15166178/57ef9c43-c35c-4479-9978-6fad89e125ae

Datron avatar May 20 '24 06:05 Datron

This PR is not ready to be merged, as types are not selectable in dropdowns yet. Currently this PR has API changes and dashboard CRUD UI.

Datron avatar May 20 '24 06:05 Datron

Reviewing this big PR is a pain, if possible can we divide the changes into two PRs, backend changes and the frontend changes.

We will review the backend changes and merge it first and then the frontend can go in.

ShubhranshuSanjeev avatar May 27 '24 15:05 ShubhranshuSanjeev

@ShubhranshuSanjeev you can review this PR commit-wise, I would recommend it going as a whole

Datron avatar May 28 '24 06:05 Datron

@Datron Can you improve the UI. Like showing the schema field on choosing, Show Choose Schema for the dropdown? Screenshot 2024-06-06 at 1 05 03 PM

mahatoankitkumar avatar Jun 06 '24 07:06 mahatoankitkumar

@Datron Can you put a placeholder while creating a type template?

mahatoankitkumar avatar Jun 06 '24 07:06 mahatoankitkumar