-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Consider generating this mock server.
Using https://github.com/equinix-labs/metal-go as a starting point:
diff --git a/Makefile b/Makefile
index b454ebd..ad3da5b 100644
--- a/Makefile
+++ b/Makefile
@@ -52,14 +52,15 @@ clean:
rm -rf $(PACKAGE_PREFIX)
codegen:
- ${OPENAPI_GENERATOR} generate -g go \
+ ${OPENAPI_GENERATOR} generate -g go-server \
--package-name ${PACKAGE_MAJOR} \
--http-user-agent "${GIT_REPO}/${PACKAGE_VERSION}" \
-p packageVersion=${PACKAGE_VERSION} \
--git-user-id ${GIT_ORG} \
--git-repo-id ${GIT_REPO}/${PACKAGE_PREFIX} \
-c /local/config/openapi-generator.json \
- -o /local/${PACKAGE_PREFIX}/${PACKAGE_MAJOR} \
+ -o /local/ \
+ -p sourceFolder=${PACKAGE_PREFIX}/${PACKAGE_MAJOR} \
-i /local/${SPEC_PATCHED_DIR}/${SPEC_ROOT_FILE}
validate:The stubs would be created and the current mock implementation could be moved into the stubs.
The option to generate only interfaces could be helpful so that empty stubs return errors until they are actually implemented.
https://openapi-generator.tech/docs/generators/go-server/
One problem that I found with this patch to metal-go is that the directory structure is correctly defined as metal/v1/, but main.go puts an extra metal/ in the import path.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels