Giter Site home page Giter Site logo

Comments (3)

Revolyssup avatar Revolyssup commented on June 15, 2024 1

@acuteaura I think the change is meaningful enough that we can introduce it even if it is breaking. Replacing these fields as pointers looks good to me. The consumers should be able to upgrade to newer version with code changes. @AlinsRan What do you think?

from apisix-ingress-controller.

jianghushinian avatar jianghushinian commented on June 15, 2024

if wrote:

func buildK8sApisixRoute(name, namespace string, port int32) *apisixv2.ApisixRoute {
	return &apisixv2.ApisixRoute{
		TypeMeta: metav1.TypeMeta{
			APIVersion: "apisix.apache.org/v2",
			Kind:       "ApisixRoute",
		},
		ObjectMeta: metav1.ObjectMeta{
			Name:      name,
			Namespace: namespace,
		},
		Spec: apisixv2.ApisixRouteSpec{
			HTTP: []apisixv2.ApisixRouteHTTP{
				{
					Name: name,
					Match: apisixv2.ApisixRouteHTTPMatch{
						Hosts: []string{"xxx"},
						Paths: []string{"/*"},
					},
					Backends: []apisixv2.ApisixRouteHTTPBackend{
						{
							ServiceName: name,
							ServicePort: intstr.IntOrString{
								Type:   intstr.Int,
								IntVal: port,
							},
						},
					},
					Authentication: apisixv2.ApisixRouteAuthentication{
						Enable: false,
						Type:   "basicAuth",
					},
				},
			},
		},
	}
}

will success.

the following code is necessary, but useless, if we should use pointers to avoid mandatory parameters?

Authentication: apisixv2.ApisixRouteAuthentication{
		Enable: false,
		Type:   "basicAuth",
	}

from apisix-ingress-controller.

acuteaura avatar acuteaura commented on June 15, 2024

There's a lot more of these that have omitempty but can can't marshall from Go as nil values. Would suggest we fix these in a big swoop (being mindful of possible NPE) since it breaks other library API consumers.

from apisix-ingress-controller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.