Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test and build
name: Test

env:
REGISTRY: ghcr.io
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ This library is part of a wider OWASP Dependency Track tool chain:

1. Install the requirements: `pip install -r requirements.txt`
2. Start a OWASP DT instance locally (like via. Docker-Compose): https://docs.dependencytrack.org/getting-started/deploy-docker/
3. Run `regenerate-api-client.sh`
3. Run `regenerate-api-client.sh [patch-full.json|patch-minimal.json]`
4. Check if bug https://github.com/openapi-generators/openapi-python-client/issues/1256 is still in effect
5. Publish this library with the API version tag

Expand Down
18 changes: 9 additions & 9 deletions owasp_dt/models/api_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ class ApiKey:
last_used (Union[Unset, int]): UNIX epoch timestamp in milliseconds
public_id (Union[Unset, str]):
key (Union[Unset, str]):
legacy (Union[Unset, bool]):
masked_key (Union[Unset, str]):
legacy (Union[Unset, bool]):
"""

comment: Union[Unset, str] = UNSET
created: Union[Unset, int] = UNSET
last_used: Union[Unset, int] = UNSET
public_id: Union[Unset, str] = UNSET
key: Union[Unset, str] = UNSET
legacy: Union[Unset, bool] = UNSET
masked_key: Union[Unset, str] = UNSET
legacy: Union[Unset, bool] = UNSET
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

def to_dict(self) -> dict[str, Any]:
Expand All @@ -46,10 +46,10 @@ def to_dict(self) -> dict[str, Any]:

key = self.key

legacy = self.legacy

masked_key = self.masked_key

legacy = self.legacy

field_dict: dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
Expand All @@ -63,10 +63,10 @@ def to_dict(self) -> dict[str, Any]:
field_dict["publicId"] = public_id
if key is not UNSET:
field_dict["key"] = key
if legacy is not UNSET:
field_dict["legacy"] = legacy
if masked_key is not UNSET:
field_dict["maskedKey"] = masked_key
if legacy is not UNSET:
field_dict["legacy"] = legacy

return field_dict

Expand All @@ -83,18 +83,18 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:

key = d.pop("key", UNSET)

legacy = d.pop("legacy", UNSET)

masked_key = d.pop("maskedKey", UNSET)

legacy = d.pop("legacy", UNSET)

api_key = cls(
comment=comment,
created=created,
last_used=last_used,
public_id=public_id,
key=key,
legacy=legacy,
masked_key=masked_key,
legacy=legacy,
)

api_key.additional_properties = d
Expand Down
File renamed without changes.
51 changes: 51 additions & 0 deletions patch-minimal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"components": {
"schemas": {
"Vulnerability": {
"properties": {
"findingAttribution": {
"$ref": "#/components/schemas/FindingAttrib"
}
}
},
"FindingAttrib": {
"type": "object",
"properties": {
"attributedOn": {
"type": "integer",
"description": "UNIX epoch timestamp in milliseconds",
"format": "int64"
},
"analyzerIdentity": {
"type": "string",
"enum": [
"INTERNAL_ANALYZER",
"OSSINDEX_ANALYZER",
"NPM_AUDIT_ANALYZER",
"VULNDB_ANALYZER",
"SNYK_ANALYZER",
"TRIVY_ANALYZER",
"NONE"
]
},
"component": {
"$ref": "#/components/schemas/Component"
},
"vulnerability": {
"$ref": "#/components/schemas/Vulnerability"
},
"alternateIdentifier": {
"type": "string"
},
"referenceUrl": {
"type": "string"
},
"uuid": {
"type": "string",
"format": "uuid"
}
}
}
}
}
}
5 changes: 4 additions & 1 deletion regenerate-api-client.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/usr/bin/env bash

PATCH_FILE="$1"
USE_PATCH_FILE="${PATCH_FILE:-patch-full.json}"

curl -lo openapi.json http://localhost:8081/api/openapi.json
#jq -s 'reduce .[] as $item ({}; . * $item)' openapi.json patch.json > schema.json
jq -s '.[0] * .[1]' openapi.json patch.json > schema.json
jq -s '.[0] * .[1]' openapi.json "${USE_PATCH_FILE}" > schema.json
jq 'del(.components.schemas.FindingAttribution)' schema.json > tmp.json
mv tmp.json schema.json
openapi-python-client generate --overwrite --path ./schema.json --meta none --config generator-config.yml
6 changes: 3 additions & 3 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13355,11 +13355,11 @@
"key": {
"type": "string"
},
"legacy": {
"type": "boolean"
},
"maskedKey": {
"type": "string"
},
"legacy": {
"type": "boolean"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion test/test_upload.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from pathlib import Path
from time import sleep

import pytest
Expand All @@ -9,6 +8,7 @@
from owasp_dt.api.event import is_token_being_processed_1
from owasp_dt.models import UploadBomBody, IsTokenBeingProcessedResponse


def test_upload_sbom(client: owasp_dt.Client):
with open(test.base_dir / "files/test.sbom.xml") as sbom_file:
resp = upload_bom.sync_detailed(client=client, body=UploadBomBody(
Expand Down
1 change: 0 additions & 1 deletion test/test_violations.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest
from is_empty import empty

import owasp_dt
import test
Expand Down