forked from getkin/kin-openapi
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
openapi3gen: add CreateComponentSchemas option to export object schem…
…as to components
- Loading branch information
Showing
54 changed files
with
3,090 additions
and
407 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package openapi3_test | ||
|
||
import ( | ||
"bytes" | ||
"context" | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
"gopkg.in/yaml.v3" | ||
|
||
"github.com/getkin/kin-openapi/openapi3" | ||
) | ||
|
||
func TestMarshalAdditionalProperties(t *testing.T) { | ||
ctx := context.Background() | ||
data, err := os.ReadFile("testdata/test.openapi.additionalproperties.yml") | ||
require.NoError(t, err) | ||
|
||
loader := openapi3.NewLoader() | ||
loader.IsExternalRefsAllowed = true | ||
spec, err := loader.LoadFromData(data) | ||
require.NoError(t, err) | ||
|
||
err = spec.Validate(ctx) | ||
require.NoError(t, err) | ||
|
||
var buf bytes.Buffer | ||
enc := yaml.NewEncoder(&buf) | ||
enc.SetIndent(2) | ||
err = enc.Encode(spec) | ||
require.NoError(t, err) | ||
|
||
// Load the doc from the serialized yaml. | ||
spec2, err := loader.LoadFromData(buf.Bytes()) | ||
require.NoError(t, err) | ||
|
||
err = spec2.Validate(ctx) | ||
require.NoError(t, err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.