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 6, 2025
1 parent 20eb971 commit a9b722e
Show file tree
Hide file tree
Showing 11 changed files with 255 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import "fmt"
// "en": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.DescriptionFormats"}
// required:
// - "de"
// description: "Supported languages. Format ISO-639-1."
// description: "A detailed description of the capabilities of the extension."

// Supported languages. Format ISO-639-1.
// A detailed description of the capabilities of the extension.
type DetailedDescriptions struct {
De DescriptionFormats `json:"de"`
En *DescriptionFormats `json:"en,omitempty"`
Expand Down
8 changes: 8 additions & 0 deletions mittwaldv2/generated/schemas/marketplacev2/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
// "deprecation": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.ExtensionDeprecation"}
// "description":
// type: "string"
// description: "A short description of the capabilites of the Extension."
// "detailedDescriptions": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.DetailedDescriptions"}
// "disabled":
// type: "boolean"
Expand All @@ -39,6 +40,7 @@ import (
// description: "This is the FileId of the Logo. Retrieve the file with this id on `/v2/files/{logoRefId}`."
// "name":
// type: "string"
// example: "MyPingExtension"
// "published":
// type: "boolean"
// description: "Whether the extension has been published by the contributor."
Expand All @@ -54,6 +56,7 @@ import (
// - "disabled"
// description: "deprecated"
// deprecated: true
// "subTitle": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.SubTitle"}
// "support": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.SupportMeta"}
// "tags":
// type: "array"
Expand All @@ -66,6 +69,7 @@ import (
// - "state"
// - "published"
// - "name"
// - "subTitle"
// - "description"
// - "tags"
// - "context"
Expand All @@ -89,6 +93,7 @@ type Extension struct {
Published bool `json:"published"`
Scopes []string `json:"scopes"`
State ExtensionState `json:"state"`
SubTitle SubTitle `json:"subTitle"`
Support SupportMeta `json:"support"`
Tags []string `json:"tags"`
}
Expand Down Expand Up @@ -134,6 +139,9 @@ func (o *Extension) Validate() error {
if err := o.State.Validate(); err != nil {
return fmt.Errorf("invalid property state: %w", err)
}
if err := o.SubTitle.Validate(); err != nil {
return fmt.Errorf("invalid property subTitle: %w", err)
}
if err := o.Support.Validate(); err != nil {
return fmt.Errorf("invalid property support: %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\":\"string\",\"published\":true,\"scopes\":[\"string\"],\"state\":\"enabled\",\"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\",\"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
10 changes: 10 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"
// "subTitle": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.SubTitle"}
// "support": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.SupportMeta"}
// "tags":
// type: "array"
Expand All @@ -68,6 +69,7 @@ type OwnExtension struct {
Name string `json:"name"`
Scopes []string `json:"scopes,omitempty"`
State *OwnExtensionState `json:"state,omitempty"`
SubTitle *SubTitle `json:"subTitle,omitempty"`
Support *SupportMeta `json:"support,omitempty"`
Tags []string `json:"tags,omitempty"`
}
Expand Down Expand Up @@ -136,6 +138,14 @@ func (o *OwnExtension) Validate() error {
}(); err != nil {
return fmt.Errorf("invalid property state: %w", err)
}
if err := func() error {
if o.SubTitle == nil {
return nil
}
return o.SubTitle.Validate()
}(); err != nil {
return fmt.Errorf("invalid property subTitle: %w", err)
}
if err := func() error {
if o.Support == 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\",\"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\",\"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
27 changes: 27 additions & 0 deletions mittwaldv2/generated/schemas/marketplacev2/subtitle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
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:
// "de":
// type: "string"
// example: "Ping deine App an"
// "en":
// type: "string"
// example: "Ping your app"
// required:
// - "de"
// description: "A brief subtitle for the extension."

// A brief subtitle for the extension.
type SubTitle struct {
De string `json:"de"`
En *string `json:"en,omitempty"`
}

func (o *SubTitle) Validate() error {
return nil
}
24 changes: 24 additions & 0 deletions mittwaldv2/generated/schemas/marketplacev2/subtitle_test.go
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("SubTitle", func() {
When("unmarshaling from JSON", func() {
It("should unmarshal", func() {
exampleJSON := []byte("{\"de\":\"Ping deine App an\",\"en\":\"Ping your app\"}")

sut := marketplacev2.SubTitle{}
Expect(json.Unmarshal(exampleJSON, &sut)).To(Succeed())
Expect(sut.Validate()).To(Succeed())
})
})
})
26 changes: 26 additions & 0 deletions mittwaldv2/generated/schemas/projectv2/scaling.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package projectv2

// 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:
// "maximum":
// type: "integer"
// minimum: 1
// "minimum":
// type: "integer"
// minimum: 1
// required:
// - "minimum"
// - "maximum"

type Scaling struct {
Maximum int64 `json:"maximum"`
Minimum int64 `json:"minimum"`
}

func (o *Scaling) Validate() error {
return nil
}
24 changes: 24 additions & 0 deletions mittwaldv2/generated/schemas/projectv2/scaling_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package projectv2_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/projectv2"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

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

sut := projectv2.Scaling{}
Expect(json.Unmarshal(exampleJSON, &sut)).To(Succeed())
Expect(sut.Validate()).To(Succeed())
})
})
})
108 changes: 108 additions & 0 deletions mittwaldv2/generated/schemas/projectv2/serverinternal.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package projectv2

import (
"fmt"
"time"
)

// 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:
// "clusterName":
// type: "string"
// "createdAt":
// type: "string"
// format: "date-time"
// "customerId":
// type: "string"
// example: "673c107f-75e1-451c-8eaa-5bf101bd2b2c"
// "description":
// type: "string"
// example: "My first Server!"
// "disabledReason": {"$ref": "#/components/schemas/de.mittwald.v1.project.ServerDisableReason"}
// "id":
// type: "string"
// format: "uuid"
// "imageRefId":
// type: "string"
// format: "uuid"
// "isReady":
// type: "boolean"
// description: "deprecated by property status"
// deprecated: true
// "machineType": {"$ref": "#/components/schemas/de.mittwald.v1.project.MachineType"}
// "readiness": {"$ref": "#/components/schemas/de.mittwald.v1.project.DeprecatedServerReadinessStatus"}
// "scaling": {"$ref": "#/components/schemas/de.mittwald.v1.project.Scaling"}
// "shortId":
// type: "string"
// example: "s-4e7tz3"
// "statisticsBaseDomain":
// type: "string"
// format: "hostname"
// example: "pe-prod.staging.mcloud.services"
// "status": {"$ref": "#/components/schemas/de.mittwald.v1.project.ServerStatus"}
// "storage":
// type: "string"
// example: "50Gi"
// required:
// - "id"
// - "shortId"
// - "customerId"
// - "machineType"
// - "storage"
// - "description"
// - "isReady"
// - "readiness"
// - "createdAt"
// - "clusterName"
// - "status"

type ServerInternal struct {
ClusterName string `json:"clusterName"`
CreatedAt time.Time `json:"createdAt"`
CustomerId string `json:"customerId"`
Description string `json:"description"`
DisabledReason *ServerDisableReason `json:"disabledReason,omitempty"`
Id string `json:"id"`
ImageRefId *string `json:"imageRefId,omitempty"`
IsReady bool `json:"isReady"`
MachineType MachineType `json:"machineType"`
Readiness DeprecatedServerReadinessStatus `json:"readiness"`
Scaling *Scaling `json:"scaling,omitempty"`
ShortId string `json:"shortId"`
StatisticsBaseDomain *string `json:"statisticsBaseDomain,omitempty"`
Status ServerStatus `json:"status"`
Storage string `json:"storage"`
}

func (o *ServerInternal) Validate() error {
if err := func() error {
if o.DisabledReason == nil {
return nil
}
return o.DisabledReason.Validate()
}(); err != nil {
return fmt.Errorf("invalid property disabledReason: %w", err)
}
if err := o.MachineType.Validate(); err != nil {
return fmt.Errorf("invalid property machineType: %w", err)
}
if err := o.Readiness.Validate(); err != nil {
return fmt.Errorf("invalid property readiness: %w", err)
}
if err := func() error {
if o.Scaling == nil {
return nil
}
return o.Scaling.Validate()
}(); err != nil {
return fmt.Errorf("invalid property scaling: %w", err)
}
if err := o.Status.Validate(); err != nil {
return fmt.Errorf("invalid property status: %w", err)
}
return nil
}
24 changes: 24 additions & 0 deletions mittwaldv2/generated/schemas/projectv2/serverinternal_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package projectv2_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/projectv2"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

var _ = Describe("ServerInternal", func() {
When("unmarshaling from JSON", func() {
It("should unmarshal", func() {
exampleJSON := []byte("{\"clusterName\":\"string\",\"createdAt\":\"2006-01-02T15:04:05Z\",\"customerId\":\"673c107f-75e1-451c-8eaa-5bf101bd2b2c\",\"description\":\"My first Server!\",\"disabledReason\":\"suspended\",\"id\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"imageRefId\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"isReady\":true,\"machineType\":{\"cpu\":\"2\",\"memory\":\"4Gi\",\"name\":\"shared.large\"},\"readiness\":\"creating\",\"scaling\":{\"maximum\":42,\"minimum\":42},\"shortId\":\"s-4e7tz3\",\"statisticsBaseDomain\":\"pe-prod.staging.mcloud.services\",\"status\":\"pending\",\"storage\":\"50Gi\"}")

sut := projectv2.ServerInternal{}
Expect(json.Unmarshal(exampleJSON, &sut)).To(Succeed())
Expect(sut.Validate()).To(Succeed())
})
})
})

0 comments on commit a9b722e

Please sign in to comment.