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 12, 2025
1 parent 955ce7c commit 5840200
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 32 deletions.
26 changes: 17 additions & 9 deletions mittwaldv2/generated/schemas/marketplacev2/contributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import "fmt"
// type: "string"
// "email":
// type: "string"
// deprecated: true
// "id":
// type: "string"
// format: "uuid"
Expand All @@ -24,30 +25,37 @@ import "fmt"
// type: "string"
// "phone":
// type: "string"
// deprecated: true
// "state": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.ContributorState"}
// "supportInformation": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.SupportMeta"}
// "url":
// type: "string"
// required:
// - "id"
// - "customerId"
// - "state"
// - "name"
// - "supportInformation"

type Contributor struct {
CustomerId string `json:"customerId"`
Description *string `json:"description,omitempty"`
Email *string `json:"email,omitempty"`
Id string `json:"id"`
LogoRefId *string `json:"logoRefId,omitempty"`
Name string `json:"name"`
Phone *string `json:"phone,omitempty"`
State ContributorState `json:"state"`
Url *string `json:"url,omitempty"`
CustomerId string `json:"customerId"`
Description *string `json:"description,omitempty"`
Email *string `json:"email,omitempty"`
Id string `json:"id"`
LogoRefId *string `json:"logoRefId,omitempty"`
Name string `json:"name"`
Phone *string `json:"phone,omitempty"`
State ContributorState `json:"state"`
SupportInformation SupportMeta `json:"supportInformation"`
Url *string `json:"url,omitempty"`
}

func (o *Contributor) Validate() error {
if err := o.State.Validate(); err != nil {
return fmt.Errorf("invalid property state: %w", err)
}
if err := o.SupportInformation.Validate(); err != nil {
return fmt.Errorf("invalid property supportInformation: %w", err)
}
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
var _ = Describe("Contributor", func() {
When("unmarshaling from JSON", func() {
It("should unmarshal", func() {
exampleJSON := []byte("{\"customerId\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"description\":\"string\",\"email\":\"string\",\"id\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"logoRefId\":\"string\",\"name\":\"string\",\"phone\":\"string\",\"state\":\"enabled\",\"url\":\"string\"}")
exampleJSON := []byte("{\"customerId\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"description\":\"string\",\"email\":\"string\",\"id\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"logoRefId\":\"string\",\"name\":\"string\",\"phone\":\"string\",\"state\":\"enabled\",\"supportInformation\":{\"email\":\"[email protected]\",\"phone\":\"string\"},\"url\":\"string\"}")

sut := marketplacev2.Contributor{}
Expect(json.Unmarshal(exampleJSON, &sut)).To(Succeed())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package marketplacev2
// type: "object"
// properties:
// "amountOfInstances":
// exclusiveMinimum: false
// type: "integer"
// minimum: 0
// example: 42
Expand Down
76 changes: 58 additions & 18 deletions mittwaldv2/generated/schemas/marketplacev2/ownextension.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,29 @@ import "fmt"
// "frontendFragments":
// type: "object"
// additionalProperties: {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.FrontendFragment"}
// "functional":
// type: "boolean"
// "id":
// type: "string"
// format: "uuid"
// "logoRefId":
// type: "string"
// format: "uuid"
// description: "This is the FileId of the Logo. Retrieve the file with this id on `/v2/files/{logoRefId}`."
// "name":
// type: "string"
// "published":
// type: "boolean"
// "requestedChanges":
// type: "object"
// properties:
// "context": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.Context"}
// "scopes":
// type: "array"
// items:
// type: "string"
// "webhookUrls": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.BackendComponents"}
// additionalProperties: false
// "scopes":
// type: "array"
// items:
Expand All @@ -50,31 +68,45 @@ import "fmt"
// type: "array"
// items:
// type: "string"
// "verificationRequested":
// type: "boolean"
// "verified":
// type: "boolean"
// required:
// - "id"
// - "contributorId"
// - "name"
// - "statistics"
// - "published"
// - "verified"
// - "verificationRequested"
// - "functional"

type OwnExtension struct {
BackendComponents *BackendComponents `json:"backendComponents,omitempty"`
Blocked *bool `json:"blocked,omitempty"`
Context *Context `json:"context,omitempty"`
ContributorId string `json:"contributorId"`
Deprecation *ExtensionDeprecation `json:"deprecation,omitempty"`
Description *string `json:"description,omitempty"`
DetailedDescriptions *DetailedDescriptions `json:"detailedDescriptions,omitempty"`
Disabled *bool `json:"disabled,omitempty"`
FrontendComponents []ExternalComponent `json:"frontendComponents,omitempty"`
FrontendFragments map[string]any `json:"frontendFragments,omitempty"`
Id string `json:"id"`
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"`
BackendComponents *BackendComponents `json:"backendComponents,omitempty"`
Blocked *bool `json:"blocked,omitempty"`
Context *Context `json:"context,omitempty"`
ContributorId string `json:"contributorId"`
Deprecation *ExtensionDeprecation `json:"deprecation,omitempty"`
Description *string `json:"description,omitempty"`
DetailedDescriptions *DetailedDescriptions `json:"detailedDescriptions,omitempty"`
Disabled *bool `json:"disabled,omitempty"`
FrontendComponents []ExternalComponent `json:"frontendComponents,omitempty"`
FrontendFragments map[string]any `json:"frontendFragments,omitempty"`
Functional bool `json:"functional"`
Id string `json:"id"`
LogoRefId *string `json:"logoRefId,omitempty"`
Name string `json:"name"`
Published bool `json:"published"`
RequestedChanges *OwnExtensionRequestedChanges `json:"requestedChanges,omitempty"`
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"`
VerificationRequested bool `json:"verificationRequested"`
Verified bool `json:"verified"`
}

func (o *OwnExtension) Validate() error {
Expand Down Expand Up @@ -125,6 +157,14 @@ func (o *OwnExtension) Validate() error {
}(); err != nil {
return fmt.Errorf("invalid property frontendComponents: %w", err)
}
if err := func() error {
if o.RequestedChanges == nil {
return nil
}
return o.RequestedChanges.Validate()
}(); err != nil {
return fmt.Errorf("invalid property requestedChanges: %w", err)
}
if err := func() error {
if o.Scopes == nil {
return nil
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package marketplacev2

import "fmt"

// 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:
// "context": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.Context"}
// "scopes":
// type: "array"
// items:
// type: "string"
// "webhookUrls": {"$ref": "#/components/schemas/de.mittwald.v1.marketplace.BackendComponents"}
// additionalProperties: false

type OwnExtensionRequestedChanges struct {
Context *Context `json:"context,omitempty"`
Scopes []string `json:"scopes,omitempty"`
WebhookUrls *BackendComponents `json:"webhookUrls,omitempty"`
}

func (o *OwnExtensionRequestedChanges) Validate() error {
if err := func() error {
if o.Context == nil {
return nil
}
return o.Context.Validate()
}(); err != nil {
return fmt.Errorf("invalid property context: %w", err)
}
if err := func() error {
if o.Scopes == nil {
return nil
}
return nil
}(); err != nil {
return fmt.Errorf("invalid property scopes: %w", err)
}
if err := func() error {
if o.WebhookUrls == nil {
return nil
}
return o.WebhookUrls.Validate()
}(); err != nil {
return fmt.Errorf("invalid property webhookUrls: %w", err)
}
return nil
}
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\",\"statistics\":{\"amountOfInstances\":42},\"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},\"functional\":true,\"id\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"logoRefId\":\"7a9d8971-09b0-4c39-8c64-546b6e1875ce\",\"name\":\"string\",\"published\":true,\"requestedChanges\":{\"context\":\"project\",\"scopes\":[\"string\"],\"webhookUrls\":{\"extensionAddedToContext\":{\"url\":\"string\"},\"extensionInstanceRemovedFromContext\":{\"url\":\"string\"},\"extensionInstanceSecretRotated\":{\"url\":\"string\"},\"extensionInstanceUpdated\":{\"url\":\"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\"],\"verificationRequested\":true,\"verified\":true}")

sut := marketplacev2.OwnExtension{}
Expect(json.Unmarshal(exampleJSON, &sut)).To(Succeed())
Expand Down
6 changes: 4 additions & 2 deletions mittwaldv2/generated/schemas/marketplacev2/subtitle.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ package marketplacev2
// properties:
// "de":
// type: "string"
// maxLength: 40
// example: "Ping deine App an"
// "en":
// type: "string"
// maxLength: 40
// example: "Ping your app"
// required:
// - "de"
// description: "A brief subtitle for the extension."
// description: "A few words to promote your Extension."

// A brief subtitle for the extension.
// A few words to promote your Extension.
type SubTitle struct {
De string `json:"de"`
En *string `json:"en,omitempty"`
Expand Down

0 comments on commit 5840200

Please sign in to comment.