-
Notifications
You must be signed in to change notification settings - Fork 26
Autogenerated RPC types #1136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Autogenerated RPC types #1136
Changes from 3 commits
fd6dd20
7114179
829bfd8
6ce3c42
3669b27
d3ceb1b
5f6aeb5
9539683
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| import { GenericParamMetadata, ParamClass, ParamType } from "./param"; | ||
|
|
||
| // jq -r '[.result.objects | to_entries[] | .value.relationships // {} | keys[]] | unique | sort[]' ./response.json | ||
| type RelationshipKey = | ||
| | "enrolledby" | ||
| | "ipaallowedtoperform_read_keys" | ||
| | "ipaallowedtoperform_write_delegation" | ||
| | "ipaallowedtoperform_write_keys" | ||
| | "ipalocation" | ||
| | "iparepltopomanagedsuffix" | ||
| | "managedby" | ||
| | "managing" | ||
| | "member" | ||
| | "memberhost" | ||
| | "memberindirect" | ||
| | "membermanager" | ||
| | "memberof" | ||
| | "memberofindirect" | ||
| | "memberuser" | ||
| | "role"; | ||
|
|
||
| type Relationships = { | ||
| [K in RelationshipKey]: [string, null | string, string]; | ||
| }; | ||
|
|
||
| type AttributeMembers = { | ||
| [K in RelationshipKey]: RelationshipKey[]; | ||
| }; | ||
|
|
||
| type ObjectMetadata<T extends string> = { | ||
| name: T; | ||
| takes_params: GenericParamMetadata<ParamClass, ParamType>[]; | ||
| methods: string[]; | ||
| } & PrimaryKeyObjectMetadata; | ||
|
|
||
| type PrimaryKeyObjectMetadata = { | ||
| primary_key: string; | ||
| }; | ||
|
|
||
| type ComplexObjectMetadata<T extends string> = { | ||
| parent_object: string; | ||
| container_dn: string; | ||
| object_name: string; | ||
| object_name_plural: string; | ||
| object_class: string[]; | ||
| object_class_config: null; | ||
| default_attributes: string[]; | ||
| label: string; | ||
| label_singular: string; | ||
| hidden_attributes: string[]; | ||
| uuid_attribute: string; | ||
| attribute_member: AttributeMembers; | ||
| rdn_attribute: string; | ||
| bindable: boolean; | ||
| relationships: Relationships; | ||
| primary_key: string; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But you are already adding the PrimaryKeyObjectMetadata, so why have the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an oversight, thank you. |
||
| aciattrs: string[]; | ||
| can_have_permissions: boolean; | ||
| } & PrimaryKeyObjectMetadata & | ||
| ObjectMetadata<T>; | ||
|
|
||
| type ObjectRecord<T extends string> = { | ||
| [K in T]: ObjectMetadata<T> | ComplexObjectMetadata<T>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are not using the K here. Did you mean |
||
| }; | ||
|
|
||
| type MethodRecord<T extends string> = { | ||
| doc: string; | ||
| NO_CLI: boolean; | ||
| takes_options: GenericParamMetadata<ParamClass, ParamType>[]; | ||
| } & ObjectMetadata<T>; | ||
|
|
||
| export type Metadata = { | ||
| objects: ObjectRecord<string>; | ||
| methods: MethodRecord<string>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will only be one method though, right? why the plural form then? Also, why are methods and commands with the same type. what is the reason for that?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A mistake, it should be an array. I don't know why the types are equal, commands contain every function, while methods are bounds to objects, say user,
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think after a certain point I just gave up, as mapping this type is too complex and useless. |
||
| commands: MethodRecord<string>; | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.