Skip to content

Commit

Permalink
chore: update auto-generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
mittwald-machine committed Feb 7, 2025
1 parent 59225a3 commit af4115d
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 2 deletions.
6 changes: 6 additions & 0 deletions mittwaldv2/generated/schemas/marketplacev2/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import (
// - "disabled"
// description: "deprecated"
// deprecated: true
// "statistics": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.ExtensionStatistics"}
// "subTitle": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.SubTitle"}
// "support": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.SupportMeta"}
// "tags":
Expand All @@ -76,6 +77,7 @@ import (
// - "scopes"
// - "disabled"
// - "blocked"
// - "statistics"

type Extension struct {
Blocked bool `json:"blocked"`
Expand All @@ -93,6 +95,7 @@ type Extension struct {
Published bool `json:"published"`
Scopes []string `json:"scopes"`
State ExtensionState `json:"state"`
Statistics ExtensionStatistics `json:"statistics"`
SubTitle SubTitle `json:"subTitle"`
Support SupportMeta `json:"support"`
Tags []string `json:"tags"`
Expand Down Expand Up @@ -139,6 +142,9 @@ func (o *Extension) Validate() error {
if err := o.State.Validate(); err != nil {
return fmt.Errorf("invalid property state: %w", err)
}
if err := o.Statistics.Validate(); err != nil {
return fmt.Errorf("invalid property statistics: %w", err)
}
if err := o.SubTitle.Validate(); err != nil {
return fmt.Errorf("invalid property subTitle: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
var _ = Describe("Extension", func() {
When("unmarshaling from JSON", func() {
It("should unmarshal", func() {
exampleJSON := []byte("{\"blocked\":true,\"context\":\"project\",\"contributorId\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"deprecation\":{\"deprecatedAt\":\"2006-01-02T15:04:05Z\",\"note\":\"This extension is no longer actively maintained. Please Use the successor extension instead.\",\"successorId\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\"},\"description\":\"string\",\"detailedDescriptions\":{\"de\":{\"markdown\":\"string\",\"plain\":\"string\"},\"en\":{\"markdown\":\"string\",\"plain\":\"string\"}},\"disabled\":true,\"frontendComponents\":[{\"name\":\"string\",\"url\":\"string\"}],\"frontendFragments\":{\"string\":null},\"id\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"logoRefId\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"name\":\"MyPingExtension\",\"published\":true,\"scopes\":[\"string\"],\"state\":\"enabled\",\"subTitle\":{\"de\":\"Ping deine App an\",\"en\":\"Ping your app\"},\"support\":{\"email\":\"[email protected]\",\"phone\":\"string\"},\"tags\":[\"string\"]}")
exampleJSON := []byte("{\"blocked\":true,\"context\":\"project\",\"contributorId\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"deprecation\":{\"deprecatedAt\":\"2006-01-02T15:04:05Z\",\"note\":\"This extension is no longer actively maintained. Please Use the successor extension instead.\",\"successorId\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\"},\"description\":\"string\",\"detailedDescriptions\":{\"de\":{\"markdown\":\"string\",\"plain\":\"string\"},\"en\":{\"markdown\":\"string\",\"plain\":\"string\"}},\"disabled\":true,\"frontendComponents\":[{\"name\":\"string\",\"url\":\"string\"}],\"frontendFragments\":{\"string\":null},\"id\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"logoRefId\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"name\":\"MyPingExtension\",\"published\":true,\"scopes\":[\"string\"],\"state\":\"enabled\",\"statistics\":{\"amountOfInstances\":42},\"subTitle\":{\"de\":\"Ping deine App an\",\"en\":\"Ping your app\"},\"support\":{\"email\":\"[email protected]\",\"phone\":\"string\"},\"tags\":[\"string\"]}")

sut := marketplacev2.Extension{}
Expect(json.Unmarshal(exampleJSON, &sut)).To(Succeed())
Expand Down
23 changes: 23 additions & 0 deletions mittwaldv2/generated/schemas/marketplacev2/extensionstatistics.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package marketplacev2

// This code was automatically generated by github.com/mittwald/api-client-go-builder.
// DO NOT EDIT.

//This data type was generated from the following JSON schema:
// type: "object"
// properties:
// "amountOfInstances":
// exclusiveMinimum: false
// type: "integer"
// minimum: 0
// example: 42
// required:
// - "amountOfInstances"

type ExtensionStatistics struct {
AmountOfInstances int64 `json:"amountOfInstances"`
}

func (o *ExtensionStatistics) Validate() error {
return nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package marketplacev2_test

// This code was automatically generated by github.com/mittwald/api-client-go-builder.
// DO NOT EDIT.

import (
"encoding/json"

"github.com/mittwald/api-client-go/mittwaldv2/generated/schemas/marketplacev2"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

var _ = Describe("ExtensionStatistics", func() {
When("unmarshaling from JSON", func() {
It("should unmarshal", func() {
exampleJSON := []byte("{\"amountOfInstances\":42}")

sut := marketplacev2.ExtensionStatistics{}
Expect(json.Unmarshal(exampleJSON, &sut)).To(Succeed())
Expect(sut.Validate()).To(Succeed())
})
})
})
6 changes: 6 additions & 0 deletions mittwaldv2/generated/schemas/marketplacev2/ownextension.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import "fmt"
// - "blocked"
// - "disabled"
// description: "deprecated"
// "statistics": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.ExtensionStatistics"}
// "subTitle": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.SubTitle"}
// "support": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.SupportMeta"}
// "tags":
Expand All @@ -53,6 +54,7 @@ import "fmt"
// - "id"
// - "contributorId"
// - "name"
// - "statistics"

type OwnExtension struct {
BackendComponents *BackendComponents `json:"backendComponents,omitempty"`
Expand All @@ -69,6 +71,7 @@ type OwnExtension struct {
Name string `json:"name"`
Scopes []string `json:"scopes,omitempty"`
State *OwnExtensionState `json:"state,omitempty"`
Statistics ExtensionStatistics `json:"statistics"`
SubTitle *SubTitle `json:"subTitle,omitempty"`
Support *SupportMeta `json:"support,omitempty"`
Tags []string `json:"tags,omitempty"`
Expand Down Expand Up @@ -138,6 +141,9 @@ func (o *OwnExtension) Validate() error {
}(); err != nil {
return fmt.Errorf("invalid property state: %w", err)
}
if err := o.Statistics.Validate(); err != nil {
return fmt.Errorf("invalid property statistics: %w", err)
}
if err := func() error {
if o.SubTitle == nil {
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
var _ = Describe("OwnExtension", func() {
When("unmarshaling from JSON", func() {
It("should unmarshal", func() {
exampleJSON := []byte("{\"backendComponents\":{\"extensionAddedToContext\":{\"url\":\"string\"},\"extensionInstanceRemovedFromContext\":{\"url\":\"string\"},\"extensionInstanceSecretRotated\":{\"url\":\"string\"},\"extensionInstanceUpdated\":{\"url\":\"string\"}},\"blocked\":true,\"context\":\"project\",\"contributorId\":\"string\",\"deprecation\":{\"deprecatedAt\":\"2006-01-02T15:04:05Z\",\"note\":\"This extension is no longer actively maintained. Please Use the successor extension instead.\",\"successorId\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\"},\"description\":\"string\",\"detailedDescriptions\":{\"de\":{\"markdown\":\"string\",\"plain\":\"string\"},\"en\":{\"markdown\":\"string\",\"plain\":\"string\"}},\"disabled\":true,\"frontendComponents\":[{\"name\":\"string\",\"url\":\"string\"}],\"frontendFragments\":{\"string\":null},\"id\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"name\":\"string\",\"scopes\":[\"string\"],\"state\":\"enabled\",\"subTitle\":{\"de\":\"Ping deine App an\",\"en\":\"Ping your app\"},\"support\":{\"email\":\"[email protected]\",\"phone\":\"string\"},\"tags\":[\"string\"]}")
exampleJSON := []byte("{\"backendComponents\":{\"extensionAddedToContext\":{\"url\":\"string\"},\"extensionInstanceRemovedFromContext\":{\"url\":\"string\"},\"extensionInstanceSecretRotated\":{\"url\":\"string\"},\"extensionInstanceUpdated\":{\"url\":\"string\"}},\"blocked\":true,\"context\":\"project\",\"contributorId\":\"string\",\"deprecation\":{\"deprecatedAt\":\"2006-01-02T15:04:05Z\",\"note\":\"This extension is no longer actively maintained. Please Use the successor extension instead.\",\"successorId\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\"},\"description\":\"string\",\"detailedDescriptions\":{\"de\":{\"markdown\":\"string\",\"plain\":\"string\"},\"en\":{\"markdown\":\"string\",\"plain\":\"string\"}},\"disabled\":true,\"frontendComponents\":[{\"name\":\"string\",\"url\":\"string\"}],\"frontendFragments\":{\"string\":null},\"id\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"name\":\"string\",\"scopes\":[\"string\"],\"state\":\"enabled\",\"statistics\":{\"amountOfInstances\":42},\"subTitle\":{\"de\":\"Ping deine App an\",\"en\":\"Ping your app\"},\"support\":{\"email\":\"[email protected]\",\"phone\":\"string\"},\"tags\":[\"string\"]}")

sut := marketplacev2.OwnExtension{}
Expect(json.Unmarshal(exampleJSON, &sut)).To(Succeed())
Expand Down

0 comments on commit af4115d

Please sign in to comment.