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

[WIP] Rework jobs and projects response types. #48

Draft
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

mathew-horner
Copy link
Contributor

⚠️ This PR is not meant to be merged, only to serve as a discussion artifact. ⚠️

This is a proposal for how we could restructure the API response types for jobs and projects in order to provide more consistent data across these endpoints.

In this PR, I figure we could have some discussion to talk about the structure of these response types and whether or not the way that I've reworked it makes sense. I've tried to preserve all data that had already existed for each type, however it has been restructured a bit. Please let me know if you notice that I've missed anything.

I haven't put in the work to preserve backwards compatability yet, as this PR is just a discussion piece. When the time comes to actually implement these changes, that will be done.

Some particular things to note:

Still need to figure out a few things... I will add relevant reviewers when this is ready to be looked at!

Comment on lines +97 to +103
#[derive(Serialize, Deserialize, Default, JsonSchema)]
#[serde(rename_all = "camelCase")]
pub struct ProjectStats {
pub licenses: LicensesStats,
pub issue_status: IssueStatusStats,
pub dependencies: DependenciesStats,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

These seem to be related to a job and not a project. Should this be JobStats?

Comment on lines +47 to +50
pub struct JobProject {
pub id: ProjectId,
pub name: String,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

To support group-owned projects, this probably also needs an optional group name.

Comment on lines +54 to +55
pub struct JobScore {
pub value: f64,
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be really helpful to have the per-axis scores for the job included along side the overall job score.

Comment on lines +25 to +35
/// Response type for the API /jobs/<job id> endpoint.
#[derive(Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
pub struct JobResponse {
#[serde(flatten)]
pub essentials: JobEssentials,
pub status: Status,
pub package_statuses: Vec<PackageStatusExtended>,
pub action: Action,
pub thresholds: ProjectThresholds,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

A list of issues would be a good addition here

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants