From 632611f1efc680a8674dcaca3fccfaadbe03724a Mon Sep 17 00:00:00 2001 From: Fabio Bonelli Date: Thu, 16 Oct 2025 17:50:53 +0200 Subject: [PATCH] feat: bump publiccode-parser-go to v5 --- .github/workflows/test.yml | 4 ++-- go-src/go.mod | 2 +- go-src/go.sum | 6 ++++-- go-src/publiccode-parser-wrapper.go | 2 +- src/PublicCodeV0.php | 14 ++++++++++++-- tests/ParserTest.php | 1 + 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 577c552..f88b5b3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,12 +39,12 @@ jobs: run: | mkdir -p "$GITHUB_WORKSPACE/bin" go build -C go-src -o "$GITHUB_WORKSPACE/bin/publiccode-parser" \ - github.com/italia/publiccode-parser-go/v4/publiccode-parser + github.com/italia/publiccode-parser-go/v5/publiccode-parser - run: echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH - run: | - VERSION=$(go list -C go-src -m -f '{{.Version}}' github.com/italia/publiccode-parser-go/v4) + VERSION=$(go list -C go-src -m -f '{{.Version}}' github.com/italia/publiccode-parser-go/v5) git clone --depth 1 --branch $VERSION https://github.com/italia/publiccode-parser-go.git /tmp/publiccode-parser-go mv /tmp/publiccode-parser-go/testdata/* tests/fixtures/testdata/ diff --git a/go-src/go.mod b/go-src/go.mod index c72fa41..a157ade 100644 --- a/go-src/go.mod +++ b/go-src/go.mod @@ -2,7 +2,7 @@ module publiccode-parser-wrapper go 1.24.5 -require github.com/italia/publiccode-parser-go/v4 v4.3.7 +require github.com/italia/publiccode-parser-go/v5 v5.1.1 require ( github.com/Jeffail/gabs v1.4.0 // indirect diff --git a/go-src/go.sum b/go-src/go.sum index c25bab8..9ec0f24 100644 --- a/go-src/go.sum +++ b/go-src/go.sum @@ -21,8 +21,10 @@ github.com/go-playground/validator/v10 v10.18.0 h1:BvolUXjp4zuvkZ5YN5t7ebzbhlUtP github.com/go-playground/validator/v10 v10.18.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/italia/httpclient-lib-go v0.0.2 h1:4bJLywTVd7qHPdKxJXvvhlXp436JTC4KA6dLhIl5a6c= github.com/italia/httpclient-lib-go v0.0.2/go.mod h1:b0/D3ULsBw8X+zEl7j/kSZmiMlUdj+agppneOvSq6eA= -github.com/italia/publiccode-parser-go/v4 v4.3.7 h1:TaqjbA1Cu1OFsxf8K18k3WSUi19pnpyQF0FD7DGIXxo= -github.com/italia/publiccode-parser-go/v4 v4.3.7/go.mod h1:a6Hh7o2TeSZcJkEjHdXU7A/kyHyJDVhnCPO6sT81lbo= +github.com/italia/publiccode-parser-go/v5 v5.1.0 h1:gBfi+2JjuKsSjwmSkdDFbuZRqh1xZUm2DPXH4TXrs/Y= +github.com/italia/publiccode-parser-go/v5 v5.1.0/go.mod h1:xndoanQHcweEnJlubntvOHlT/cvde0eFDF59O5PwuCg= +github.com/italia/publiccode-parser-go/v5 v5.1.1 h1:XVuWXNohNJfSvvXO3OjBoKJU09UELEtRXFpkSwOttvg= +github.com/italia/publiccode-parser-go/v5 v5.1.1/go.mod h1:xndoanQHcweEnJlubntvOHlT/cvde0eFDF59O5PwuCg= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= diff --git a/go-src/publiccode-parser-wrapper.go b/go-src/publiccode-parser-wrapper.go index 4c3032f..91c1b25 100644 --- a/go-src/publiccode-parser-wrapper.go +++ b/go-src/publiccode-parser-wrapper.go @@ -30,7 +30,7 @@ import ( "strings" "unsafe" - "github.com/italia/publiccode-parser-go/v4" + "github.com/italia/publiccode-parser-go/v5" ) //export NewParser diff --git a/src/PublicCodeV0.php b/src/PublicCodeV0.php index c36fc40..bfda612 100644 --- a/src/PublicCodeV0.php +++ b/src/PublicCodeV0.php @@ -100,9 +100,9 @@ public function getRepoOwner(): ?string return $this->data['legal']['repoOwner'] ?? null; } - public function getCategories(): array + public function getCategories(): ?array { - return $this->data['categories']; + return $this->data['categories'] ?? null; } public function getRoadmap(): ?string @@ -124,6 +124,16 @@ public function getReleaseDate(): ?\DateTimeInterface return new \DateTime($this->data['releaseDate']); } + public function getOrganisationName(): ?string + { + return $this->data['organisation']['name'] ?? null; + } + + public function getOrganisationUri(): ?string + { + return $this->data['organisation']['uri'] ?? null; + } + public function getDevelopmentStatus(): string { return $this->data['developmentStatus']; diff --git a/tests/ParserTest.php b/tests/ParserTest.php index 4c55e3e..6e57ecd 100644 --- a/tests/ParserTest.php +++ b/tests/ParserTest.php @@ -56,6 +56,7 @@ public function testPublicCodeAccessors(): void $this->assertEquals('community', $maintenance['type']); $categories = $publicCode->getCategories(); + $this->assertNotNull($categories); $this->assertContains('cloud-management', $categories); }