Skip to content

global-rule: drop or warn on --id (API7 EE forces id = plugin name) #37

@shreemaan-abhishek

Description

@shreemaan-abhishek

Found during Run 2 smoke testing (see docs/ga-test-report.md).

Problem

a7 global-rule create --id smoke-gr-X --plugins-json '{"cors":...}' -g default

returns a resource at id = "cors" (the plugin name), ignoring the user-supplied --id smoke-gr-X. API7 EE enforces id == plugin name for global rules.

The CLI accepts a flag it will silently override. Run 1 noted this as 'minor — value is ignored by EE'. Treat as a real CLI bug.

Fix options

  1. Drop --id from pkg/cmd/global-rule/create/create.go entirely; document that id is derived from the plugin key.
  2. Warn / error when --id is passed and doesn't match the single plugin key in --plugins-json.

Lean toward option 1 (less surface area, less surprise).

Tests

  • TestGlobalRule_CreateWithoutID: create with --plugins-json '{"cors":...}', assert returned id == "cors"
  • If option 2 chosen: TestGlobalRule_CreateRejectsMismatchedID

Part of #22.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions