-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add optional schema
property to graph object metadata
#611
Changes from 1 commit
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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import { RelationshipClass } from '@jupiterone/data-model'; | ||
import { | ||
RelationshipClass, | ||
IntegrationEntitySchema, | ||
} from '@jupiterone/data-model'; | ||
|
||
import { | ||
ExecutionContext, | ||
|
@@ -81,9 +84,21 @@ export interface GraphObjectIndexMetadata { | |
enabled: boolean; | ||
} | ||
|
||
export interface GraphObjectSchema extends IntegrationEntitySchema { | ||
$schema?: string; | ||
$id?: string; | ||
description?: string; | ||
additionalProperties?: boolean; | ||
Comment on lines
+88
to
+91
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. Do we want to make some of these 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. e.g. 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. export interface GraphObjectSchema extends IntegrationEntitySchema {
$schema?: string;
$id?: string;
description?: string;
- additionalProperties?: boolean;
+ additionalProperties: boolean;
+ properties: Required<IntegrationEntitySchema>['properties'];
+ required: Required<IntegrationEntitySchema>['required'];
} 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. Considering the form of https://github.com/JupiterOne/data-model/blob/178d8838d6004a45ff97b229fd8a0dafd3b50e6f/src/index.ts#L6: export type IntegrationEntitySchema = {
$ref?: string;
allOf?: IntegrationEntitySchema[];
properties?: {
[propertyName: string]: any;
};
required?: string[];
}; Nothing is required there, which makes sense, allowing for various combinations of those properties. For this What do you think about naming this 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. TBH I think it's bad that we're not using the published NPM types for JSON Schema.
import { JSONSchema7 } from 'json-schema' Perhaps this type should actually be something like the following? type GraphObjectSchema = Required<Pick<JSONSchema7, 'additionalProperties' | 'required' | 'properties'>>; 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. Personally I don't see why we would want to document a 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. Also I don't love 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. Ohh, nice find on the 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. |
||
} | ||
|
||
export interface StepGraphObjectMetadata { | ||
_type: string; | ||
|
||
/** | ||
* The schema used to describe the properties assigned to this entity | ||
ndowmon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
schema?: GraphObjectSchema; | ||
|
||
/** | ||
* Indicates the set of data represented by this `_type` should always be | ||
* considered a partial dataset. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would love to see a ticket in the SDK describing this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#612
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to make some minor updates to
toMatchDirectRelationshipSchema
,toMatchGraphObjectSchema
, and add thetoMatchStepMetadata
matcher we discussed previously. Then go back and updatedocs/testing
andintegration-template