Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions compilers/openapi/internal/diag/diag.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,17 @@ const (
//
// Error, as the parser's report was.
DuplicateParameter = "openapi/duplicate-parameter"
// DuplicateServerName reports a servers list entry whose name an earlier
// entry in the same list already has, compared as written, at the repeat's
// name. Load checks every list the source writes, the document's, a path
// item's or an operation's, lowered or not, but none only a $ref reaches
// (GitHub #880). Both entries are kept, though a consumer keying servers by
// name cannot tell them apart. Names equal once canonicalized, and URL
// hints, are not reported: an emitter uniquifies them.
//
// Warning, where DuplicateParameter is an error: OpenAPI 3.2 calls the name
// "an optional unique string" with no RFC 2119 keyword.
DuplicateServerName = "openapi/duplicate-server-name"
// InvalidMethodKey reports an additionalOperations key that names no method:
// the empty string. The operation still lowers, binding the key as written, so
// nothing the entry declares is lost — what is reported is that the binding's
Expand Down
2 changes: 1 addition & 1 deletion compilers/openapi/internal/diag/diag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func codes() []string {
diag.OverlayAction, diag.OverlayOriginIncomplete,
diag.ValidationOnlyKeyword, diag.FalseSchema, diag.EmptyEnum, diag.DuplicateEnumValue,
diag.NumericPrecision, diag.ExclusiveBoundForm, diag.InvalidStatusKey,
diag.DuplicateStatusKey, diag.DuplicateParameter,
diag.DuplicateStatusKey, diag.DuplicateParameter, diag.DuplicateServerName,
diag.InvalidMethodKey, diag.DegradedConstruct,
diag.CompositionLowering, diag.DynamicRefExpanded, diag.ConflictingRedecl,
diag.DisjointVisibility,
Expand Down
2 changes: 1 addition & 1 deletion compilers/openapi/internal/load/later_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ components:
}

// TestLaterConstructs_AWalkThatPanicsIsReported pins the barrier around the
// walk, as parameterRepeats has one: a panic is an error at the model reached.
// walk, as listRepeats has one: a panic is an error at the model reached.
func TestLaterConstructs_AWalkThatPanicsIsReported(t *testing.T) {
t.Parallel()
panics := func(func(soa.WalkItem) bool) { panic("walk fault") }
Expand Down
12 changes: 6 additions & 6 deletions compilers/openapi/internal/load/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,13 @@ func validated(ctx context.Context, at func(jsontext.Pointer) ir.Provenance, loc
}

// sourceChecks runs the rules the compiler checks over the resolved source:
// the repeats of a parameter list, and the references refused for reading past
// a path item $ref into the fields beside it, less any resolved already
// reports (see besideRefs).
// the repeats of a parameter or servers list, and the references refused for
// reading past a path item $ref into the fields beside it, less any resolved
// already reports (see besideRefs).
func sourceChecks(ctx context.Context, at func(jsontext.Pointer) ir.Provenance, doc *soa.OpenAPI, sibs Siblings,
resolved []ir.Diagnostic,
) []ir.Diagnostic {
diags := parameterRepeats(at, sibs, walkSource(ctx, doc, sibs))
diags := listRepeats(at, sibs, walkSource(ctx, doc, sibs))
return append(diags, besideRefs(at, sibs, walkSource(ctx, doc, sibs), resolved)...)
}

Expand Down Expand Up @@ -357,8 +357,8 @@ func dropped(verr validation.Error) bool {
//
// Parameter uniqueness: the library reads only inline entries, so a repeat
// through a $ref went unreported, and beside the compiler's own report an
// inline repeat drew two errors. parameterRepeats checks every list the source
// writes, its $refs resolved (#634, #840).
// inline repeat drew two errors. listRepeats checks every parameter list the
// source writes, its $refs resolved (#634, #840).
func compilerOwned(verr validation.Error) bool {
return verr.Rule == validation.RuleValidationOperationIdUnique ||
verr.Rule == validation.RuleValidationOperationParameters
Expand Down
2 changes: 1 addition & 1 deletion compilers/openapi/internal/load/load_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ paths:

// TestLoad_ParameterUniquenessIsTheCompilers pins compilerOwned's second
// member: the library's report of an inline repeat is dropped, and the
// compiler's own (parameterRepeats) is the one report, at the repeat. As for
// compiler's own (paramRepeats) is the one report, at the repeat. As for
// operationIds, the test first confirms the library raises its finding for the
// fixture, or a library that stopped would leave this passing with nothing
// dropped.
Expand Down
79 changes: 0 additions & 79 deletions compilers/openapi/internal/load/params.go

This file was deleted.

179 changes: 0 additions & 179 deletions compilers/openapi/internal/load/params_internal_test.go

This file was deleted.

Loading
Loading