From 5fae4f5d9366422fe68f4c4dfcee2cc7cdec2587 Mon Sep 17 00:00:00 2001 From: Chris McEvoy <12284065+chrisimcevoy@users.noreply.github.com> Date: Thu, 1 Jun 2023 02:01:21 +0100 Subject: [PATCH] add go api key example in README.md (#15705) --- .../src/main/resources/go/README.mustache | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/go/README.mustache b/modules/openapi-generator/src/main/resources/go/README.mustache index fe14ae86d84c..fa3a0adf9e0f 100644 --- a/modules/openapi-generator/src/main/resources/go/README.mustache +++ b/modules/openapi-generator/src/main/resources/go/README.mustache @@ -110,6 +110,19 @@ Class | Method | HTTP request | Description Note, each API key must be added to a map of `map[string]APIKey` where the key is: {{keyParamName}} and passed in as the auth context for each request. +Example + +```golang +auth := context.WithValue( + context.Background(), + sw.ContextAPIKeys, + map[string]sw.APIKey{ + "{{keyParamName}}": {Key: "API_KEY_STRING"}, + }, + ) +r, err := client.Service.Operation(auth, args) +``` + {{/isApiKey}} {{#isBasic}} {{#isBasicBearer}}