Skip to content
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

[Investigations] - Add timeline api codegen #187172

Closed

Conversation

michaelolo24
Copy link
Contributor

@michaelolo24 michaelolo24 commented Jun 28, 2024

Summary

Epic: https://github.com/elastic/security-team/issues/9400

Introduce automatic zod schema generation of api's based on open api spec.

Testing:

  • Validate schema validity
  • Validate the yaml schema matches the current schema
  • To generate the zod schemas: From the security_solution path, run yarn openapi:generate

@michaelolo24 michaelolo24 added the Team:Threat Hunting:Investigations Security Solution Investigations Team label Jun 28, 2024
@@ -25,6 +25,8 @@
{{~else~}}
.merge({{> zod_schema_item }})
{{~/if~}}
{{~#if ../nullable}}.nullable(){{/if~}}
Copy link
Contributor Author

@michaelolo24 michaelolo24 Jul 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to update based on how nullable: true interacts with the $ref. Reference Issue

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelolo24 is this something you consider a blocker for this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I updated this, so it was more of a note. Updated the text from Need => Needed as it was done :)

@michaelolo24 michaelolo24 marked this pull request as ready for review July 8, 2024 17:29
@michaelolo24 michaelolo24 requested review from a team as code owners July 8, 2024 17:29
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations)

@michaelolo24 michaelolo24 added release_note:skip Skip the PR/issue when compiling release notes v8.16.0 labels Jul 8, 2024
@michaelolo24
Copy link
Contributor Author

/ci

@michaelolo24
Copy link
Contributor Author

/ci

Copy link
Contributor

@dplumlee dplumlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule management changes lgtm

@janmonschke
Copy link
Contributor

@michaelolo24 I'm getting a bunch of linter errors:

✖ 144 problems (50 errors, 79 warnings, 15 infos, 0 hints)

Which config did you use when you ran spectral?

I used the ones linked from the docs: https://github.com/elastic/elastic-openapi/blob/main/.spectral.yaml

@@ -39,9 +39,9 @@ paths:
type: object
properties:
getOneTimeline:
oneOf:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@janmonschke this is why the handlebars template needed to be updated. The old pattern here wasn't valid in the 3.0.0 schema. We'll need to change it if we update it if we ever change our schema

janmonschke added a commit to maximpn/kibana that referenced this pull request Jul 23, 2024

export type PinnedEvent = z.infer<typeof PinnedEvent>;
export const PinnedEvent = z.object({
columns: ColumnHeaderResult.optional(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be here

@michaelolo24
Copy link
Contributor Author

Closing as the necessary changes were ported here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Investigations Security Solution Investigations Team v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants