Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add server variable extensions #326

Merged
merged 2 commits into from
Sep 11, 2024

Conversation

geffersonFerraz
Copy link
Contributor

Allow to use server variable extension:

	envVar := &v3.ServerVariable{
		Enum:       []string{"api.mycompany.com", "api-preprod.mycompany.com"},
		Extensions: orderedmap.New[string, *yaml.Node](),
	}
	envVar.Description = "Environment to use"
	envVar.Default = "api.mycompany.com"
	envTransforms := []map[string]interface{}{
		{
			"type": "translate",
			"translations": []map[string]string{
				{"from": "prod", "to": "api.mycompany.com"},
				{"from": "pre-prod", "to": "api-preprod.mycompany.com"},
			},
		},
	}
	envVar.Extensions.Set("x-transforms", createExtension(envTransforms))
	server.Variables.Set("env", envVar)

	mergedSpecA.Model.Servers = append(mergedSpecA.Model.Servers, server)

Copy link
Member

@daveshanley daveshanley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for your contribution.

Copy link

codecov bot commented Aug 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.64%. Comparing base (49a2921) to head (d26b0d2).
Report is 22 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #326   +/-   ##
=======================================
  Coverage   99.63%   99.64%           
=======================================
  Files         164      164           
  Lines       16586    16674   +88     
=======================================
+ Hits        16526    16614   +88     
  Misses         55       55           
  Partials        5        5           
Flag Coverage Δ
unittests 99.64% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@daveshanley
Copy link
Member

Two lines to cover and it's good to go.

@daveshanley
Copy link
Member

Fix the tests and I can add this in!

datamodel/low/v3/server_test.go Outdated Show resolved Hide resolved
@daveshanley daveshanley merged commit efe5523 into pb33f:main Sep 11, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants