Skip to content

Field possibly erroneously set as Schema.RequiredMode.REQUIRED #6018

@cardamon

Description

@cardamon

Current Behavior

/**
* The optional date when the component was last published.
*/
@Persistent
@Column(name = "PUBLISHED")
@Schema(type = "integer", format = "int64", requiredMode = Schema.RequiredMode.REQUIRED, description = "UNIX epoch timestamp in milliseconds")
private Date published;

Comment says it's optional and from a quick search through the code base it appears to indeed be conditionally set, not set at all, etc.

This may cause issues for generated OpenAPI clients which assume that the field is always set.

Steps to Reproduce

An API call to /v1/repository/latest may return data such as:

{
    "repositoryType": "NPM",
    "name": "buffer",
    "latestVersion": "6.0.3",
    "lastCheck": 1775555220982
}

in which published is absent.

Expected Behavior

Either published to always have some value (0?) or, for it not be set as required.

Dependency-Track Version

4.13.3

Dependency-Track Distribution

Container Image

Database Server

N/A

Database Server Version

No response

Browser

N/A

Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions