Skip to content

Add Golang SDK docs and source-to-function example

07d47df
Select commit
Loading
Failed to load commit list.
Open

Add SDK docs with Python and Go source-to-function examples #428

Add Golang SDK docs and source-to-function example
07d47df
Select commit
Loading
Failed to load commit list.
reviewfn / succeeded Apr 28, 2026 in 1m 42s

AI Code Review Results

AI Pull Request Overview

Summary

  • Adds comprehensive SDK documentation for Python and Go
  • Includes source-to-function examples demonstrating namespace, secret, build, deploy, and invoke workflows
  • Updates navigation to include new SDKs section
  • Modifies existing Python API example to reference SDK

Approval rating

7/10 - Solid documentation addition with working examples, but Go code has potential nil pointer issue in readiness check

Summary per file

Summary per file
File path Summary
docs/sdks/index.md Overview of Python and Go SDKs with install and feature lists
docs/sdks/go/examples/source-to-function.md Complete Go example for source-to-function workflow with code snippets
docs/sdks/python/examples/source-to-function.md Complete Python example for source-to-function workflow with code snippets
docs/languages/python/examples/openfaas-api.md Updated to reference Python SDK at top
mkdocs.yml Added SDKs section to navigation menu

Overall Assessment

The PR adds valuable documentation for the OpenFaaS SDKs with practical examples that demonstrate common use cases for programmatic function management. The examples cover multi-tenant scenarios and CI/CD automation effectively. However, the Go code contains a potential runtime panic in the readiness check that should be addressed.

Detailed Review

Detailed Review

docs/sdks/index.md

  • SDK overview is clear and accurate
  • Feature lists match SDK capabilities
  • Installation instructions use git+ URLs, appropriate for development versions

docs/sdks/go/examples/source-to-function.md

  • Handler code correctly implements Bearer token authentication against mounted secret
  • Error handling in handler properly returns structured JSON responses
  • Orchestration code demonstrates proper OpenFaaS SDK usage for namespace, secret, build, and deploy operations
  • Issue: In waitForReady, the check if fn.AvailableReplicas >= 1 will panic if AvailableReplicas is nil (common in Kubernetes/OpenFaaS types where fields are pointers). Should check for nil first: if fn.AvailableReplicas != nil && *fn.AvailableReplicas >= 1
  • Build context creation uses correct template and build directory parameters
  • HMAC authentication for builder is properly implemented
  • Log streaming and function invocation examples are correct
  • Environment variable validation is appropriate with fatal exits for missing required vars

docs/sdks/python/examples/source-to-function.md

  • Handler correctly implements Bearer token auth and readiness endpoint
  • Orchestration script properly handles exceptions and authentication
  • Readiness check safely handles optional available_replicas field
  • Build and deploy workflow matches Go implementation
  • Annotations for readiness probe are correctly configured
  • UUID-based API key generation is more secure than timestamp

docs/languages/python/examples/openfaas-api.md

  • Updated introduction properly references Python SDK
  • Code examples remain correct and demonstrate idempotent namespace creation
  • Authentication helper addition shows proper Bearer token validation
  • Secret mounting and environment configuration are accurate

mkdocs.yml

  • Navigation update correctly adds SDKs section with proper hierarchy
  • Links to new documentation pages are accurate

AI agent details.

Agent processing time: 1m35.894s
Environment preparation time: 3.984s
Total time from webhook: 1m43.938s