Improve Go client tests (#21919)

* test withXml option

* fix path

* update go code (withXml: true)

* test one more go client
This commit is contained in:
William Cheng 2025-09-08 16:45:46 +08:00 committed by GitHub
parent 6e089f5f03
commit bdfbb32cdd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 11 deletions

View File

@ -5,10 +5,12 @@ on:
paths:
- 'samples/openapi3/client/petstore/go/go-petstore-aws-signature/**'
- 'samples/openapi3/client/petstore/go-petstore-withXml/**'
- samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/**
pull_request:
paths:
- 'samples/openapi3/client/petstore/go/go-petstore-aws-signature/**'
- 'samples/openapi3/client/petstore/go-petstore-withXml/**'
- samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/**
jobs:
build:
@ -20,6 +22,7 @@ jobs:
sample:
- 'samples/openapi3/client/petstore/go/go-petstore-aws-signature/'
- 'samples/openapi3/client/petstore/go-petstore-withXml/'
- samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6

View File

@ -6,4 +6,4 @@ additionalProperties:
enumClassPrefix: "true"
packageName: petstore
disallowAdditionalPropertiesIfNotPresent: false
withXml: false
withXml: true

View File

@ -19,8 +19,8 @@ var _ MappedNullable = &Category{}
// Category A category for a pet
type Category struct {
Id *int64 `json:"id,omitempty"`
Name *string `json:"name,omitempty" validate:"regexp=^[a-zA-Z0-9]+[a-zA-Z0-9\\\\.\\\\-_]*[a-zA-Z0-9]+$"`
Id *int64 `json:"id,omitempty" xml:"id"`
Name *string `json:"name,omitempty" xml:"name" validate:"regexp=^[a-zA-Z0-9]+[a-zA-Z0-9\\\\.\\\\-_]*[a-zA-Z0-9]+$"`
AdditionalProperties map[string]interface{}
}

View File

@ -20,14 +20,14 @@ var _ MappedNullable = &Pet{}
// Pet A pet for sale in the pet store
type Pet struct {
Id *int64 `json:"id,omitempty"`
Category *Category `json:"category,omitempty"`
Name string `json:"name"`
PhotoUrls []string `json:"photoUrls"`
Tags []Tag `json:"tags,omitempty"`
Id *int64 `json:"id,omitempty" xml:"id"`
Category *Category `json:"category,omitempty" xml:"category"`
Name string `json:"name" xml:"name"`
PhotoUrls []string `json:"photoUrls" xml:"photoUrls>photoUrl"`
Tags []Tag `json:"tags,omitempty" xml:"tags>tag"`
// pet status in the store
// Deprecated
Status *string `json:"status,omitempty"`
Status *string `json:"status,omitempty" xml:"status"`
AdditionalProperties map[string]interface{}
}

View File

@ -19,8 +19,8 @@ var _ MappedNullable = &Tag{}
// Tag A tag for a pet
type Tag struct {
Id *int64 `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Id *int64 `json:"id,omitempty" xml:"id"`
Name *string `json:"name,omitempty" xml:"name"`
AdditionalProperties map[string]interface{}
}