File: issue594_test.go

package info (click to toggle)
golang-github-getkin-kin-openapi 0.124.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,288 kB
  • sloc: sh: 344; makefile: 4
file content (31 lines) | stat: -rw-r--r-- 754 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package openapi3_test

import (
	"net/url"
	"testing"

	"github.com/stretchr/testify/require"

	"github.com/getkin/kin-openapi/openapi3"
)

func TestIssue594(t *testing.T) {
	uri, err := url.Parse("https://raw.githubusercontent.com/sendgrid/sendgrid-oai/c3aaa432b769faa47285166aca17c7ed2ea71787/oai_v3_stoplight.json")
	require.NoError(t, err)

	sl := openapi3.NewLoader()
	var doc *openapi3.T
	if false {
		doc, err = sl.LoadFromURI(uri)
	} else {
		doc, err = sl.LoadFromFile("testdata/oai_v3_stoplight.json")
	}
	require.NoError(t, err)

	doc.Info.Version = "1.2.3"
	doc.Paths.Value("/marketing/contacts/search/emails").Post = nil
	doc.Components.Schemas["full-segment"].Value.Example = nil

	err = doc.Validate(sl.Context)
	require.NoError(t, err)
}