forked from loafle/openapi-generator-original
* [go] use regular stdlib import names * [go] support primitive oneOf types See #8489 * [go] improve pbv/pbr handling Improves the way pass-by-value and pass-by-reference variables are used. Closes #8489 * [go] improve generated documentation * [go] adopt pointer changes in interface * [go] regenerate sample * [go] resolve pointer issues * [go] regenerate clients and avoid pointers on primitive return values * [go] improve Exec() return value handling * [go] regernate files * [go] use go modules * [go] properly handle polymorph decode If polymorphism without discriminator was used, the previous code was unable to properly decode the vaules. By using a strict decoder, which rejects unknown fields, type guessing now works. * [go] make GetActualInstance not panic on nil * [go] return GenericOpenAPIError as pointer * [go] clarify helper function godoc * [go] address test regression error type * [go] regenerate go samples * [go] resolve go mod issues and test regressions * [go] resolve merge conflicts and regenerate * [go] resolve merge conflicts * [go] Replace spaces with tabs Co-authored-by: Jiri Kuncar <jiri.kuncar@gmail.com> * [go] Replace spaces with tabs Co-authored-by: Jiri Kuncar <jiri.kuncar@gmail.com> Co-authored-by: Jiri Kuncar <jiri.kuncar@gmail.com>
29 lines
801 B
Go
29 lines
801 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
sw "github.com/OpenAPITools/openapi-generator/samples/client/petstore/go/go-petstore"
|
|
)
|
|
|
|
// TestPutBodyWithFileSchema ensures a model with the name 'File'
|
|
// gets converted properly to the petstore.File struct vs. *os.File
|
|
// as specified in typeMapping for 'File'.
|
|
func TestPutBodyWithFileSchema(t *testing.T) {
|
|
return // early return to test compilation
|
|
|
|
schema := sw.FileSchemaTestClass{
|
|
File: &sw.File{SourceURI: sw.PtrString("https://example.com/image.png")},
|
|
Files: []sw.File{{SourceURI: sw.PtrString("https://example.com/image.png")}}}
|
|
|
|
r, err := client.FakeApi.TestBodyWithFileSchema(context.Background()).Body(schema).Execute()
|
|
|
|
if err != nil {
|
|
t.Fatalf("Error while adding pet: %v", err)
|
|
}
|
|
if r.StatusCode != 200 {
|
|
t.Log(r)
|
|
}
|
|
}
|