GOTO Copenhagen: 10x DevEx: Shift-left API Governance = CycleTime/2

Presenter: Naresh Jain Hari Krishnan
Event: GOTO Copenhagen
Location: Denmark

Presentation summary

This real-world experience report will share a set of transformative strategies that helped us elevate our DevEx by an order of magnitude, while simultaneously helping us shorten our cycle times by 50%.

We dive into the principles of “shift-left” API governance, a proactive approach that integrates governance early in the development cycle, ensuring faster, more secure, and compliant API integrations. By starting with a collaborative API Design first approach followed by contract testing in service provider’s CI pipeline, teams can identify and mitigate risks sooner, streamline workflows, and foster a culture of collaboration, accountability and innovation. This helps them unlock unprecedented developer productivity and accelerate their release cycles.

Transcript

Table of Contents

  • The Promise and Pitfalls of gRPC
  • REST and OpenAPI Implementation
  • Modern Contract Testing
  • Parallel Development Strategies
  • Real-World Impact
  • Developer Experience Enhancement
  • Implementation Guide
  • Conclusion
  • FAQ

The Promise and Pitfalls of gRPC

Let’s talk about gRPC. If you’re among the growing number of developers adopting this framework, you’re probably drawn to its performance benefits and type safety promises. gRPC leverages HTTP/2 for transport, offering features like bi-directional streaming and multiplexing. The framework’s use of Protocol Buffers (Proto) for service contracts seems to promise an end to API contract mismatches.

But here’s the catch: that promise isn’t quite what it seems.

Testing gRPC’s Contract Safety Claims

Many developers believe gRPC’s compile-time type safety eliminates runtime errors. Here’s a simple test that proves otherwise:

Try creating a product with no data. In Proto3, you’ll find that gRPC happily accepts this empty request, creating a product with no attributes. Why? Because Proto3 makes everything optional by default in the name of backward compatibility.

This leads to two significant issues:

  • Silent acceptance of invalid data
  • Lack of clear contract requirements in the Proto file itself

Enhancing gRPC with Proto Validate

Here’s where tools like Proto Validate become essential. This library adds what gRPC’s Proto3 lacks: explicit validation rules. For example:

message Product {
string name = 1 [(validate.rules).string.min_len = 1];
int32 inventory = 2 [(validate.rules).int32.gt = 0];
}

When integrated with contract testing tools like Specmatic, these validations become part of your automated testing pipeline, catching issues before they reach production.

Real-World gRPC Implementation

Consider this practical example of a product ordering system:

  • Finding available products
  • Creating new products
  • Processing orders

Each operation needs proper validation:

  • Inventory must be in sets of three
  • Product names can’t be empty
  • Orders must reference valid products

Without proper validation and contract testing, these business rules become landmines in your API ecosystem.

Switching Gears: REST and OpenAPI Realities

While gRPC presents one set of challenges, REST APIs with OpenAPI specifications bring their own complexities. Let’s break down what actually happens when you try to implement the “generate and forget” approach many teams adopt.

The Code Generation Promise

Here’s what typically happens: You start with a pristine OpenAPI specification, run it through a generator like OpenAPI Generator, and expect production-ready code. The reality? Let’s look at a real example:

components:
schemas:
Product:
allOf:
- $ref: '#/components/schemas/ProductDetails'
- type: object
properties:
id:
type: string

When you generate code from this specification and then try to regenerate the OpenAPI doc from the resulting code, you’ll find:

  • Lost schema relationships (allOf references disappear)
  • Duplicated type definitions
  • Missing example values
  • Flattened inheritance structures

Contract Testing Challenges

Traditional approaches to contract testing often fall short in several key areas:

Data Dependencies
  • Test data management becomes a nightmare
  • External service dependencies (like payment gateways) complicate testing
  • Dynamic data requirements break traditional stub approaches
Artifact Management
  • Multiple specification versions to maintain
  • Generated code drift from specifications
  • Contract test files separate from API specifications

A Modern Approach to Contract Testing

This is where modern tools like Specmatic change the game. Instead of maintaining separate contract tests and specifications, you can:

  • Use your OpenAPI specification as the single source of truth
  • Generate both provider tests and consumer stubs automatically
  • Validate backward compatibility through automated specification testing
  • Create realistic test data based on your API’s domain

Practical Implementation

Here’s what this looks like in practice:

Start with your API specification in a central repository
Automate contract validation during pull requests
Generate consumer stubs for parallel development
Run specification-based tests against provider implementations
Validate backward compatibility before merging changes
This approach addresses the core issues we’ve seen with both gRPC and REST implementations while maintaining the benefits of each.

Parallel Development in Practice

The real power of modern contract testing comes from enabling truly parallel development. Here’s how it works:

For API Consumers

  • Pull the latest specification from the central repository
  • Generate compatible stubs automatically
  • Develop against virtual services that match the contract
  • Validate your integration before the provider implementation exists

For API Providers

  • Use the specification to drive development (TDD approach)
  • Validate implementation against generated contract tests
  • Ensure backward compatibility automatically
  • Deploy with confidence knowing consumers are compatible

Real-World Impact: The Numbers Behind Better API Development

Let’s talk concrete metrics. In a case study of a large-scale microservices environment with over 40,000 developers, here’s what happened when teams implemented these practices:

Before and After Metrics

  • Cycle time: Dropped from 129 days to 32 days per feature
  • Flow efficiency: Improved from 42% to 82%
  • Contract-related bugs: Reduced from 27% of all issues to nearly zero
  • Work in Progress (WIP): Decreased by approximately 66%

These aren’t just numbers – they represent real developer experience improvements.

Building a Better Developer Experience

Let’s break down what actually makes a great developer experience in modern API development:

Zero-Friction Development

  • Automatic stub generation from specifications
  • Immediate feedback on contract violations
  • No waiting for dependent services
  • Local development without internet dependency

Automated Guardrails

  • Contract validation during pull requests
  • Backward compatibility checking
  • Generated test suites from specifications
  • Domain-aware test data generation

Practical Implementation Guide

Here’s your roadmap for implementing these improvements:

Centralize API Specifications

  • Use Git as your single source of truth
  • Implement automated specification validation
  • Enforce backward compatibility checks

Automate Contract Testing

  • Generate tests from specifications
  • Validate both providers and consumers
  • Integrate with CI/CD pipelines

Enable Parallel Development

  • Generate consumer stubs automatically
  • Provide virtual services for development
  • Implement contract-first development practices

Conclusion

The path to better API development isn’t about choosing between gRPC or REST, or picking the perfect specification format. It’s about implementing practices that catch issues early, enable parallel development, and provide immediate feedback to developers.

By combining modern contract testing tools like Specmatic with strong development practices, teams can achieve:

  • Faster development cycles
  • Fewer integration issues
  • Better developer experience
  • More reliable APIs

The future of API development lies in automation, early validation, and tools that support rather than hinder the development process. Whether you’re working with gRPC, REST, or both, the key is implementing practices that catch issues early and enable teams to work efficiently and independently.

 

Frequently Asked Questions (FAQs)

What makes gRPC different from REST for contract testing?

While gRPC provides built-in type safety through Protocol Buffers, it lacks validation by default in Proto3. REST with OpenAPI offers more explicit contract definition but requires additional tooling for effective testing. Both benefit from automated contract validation tools.

How do you handle backward compatibility in practice?

Modern contract testing tools can automatically validate compatibility by:

  • Running new specification versions against old consumer tests
  • Validating breaking changes during pull requests
  • Enforcing semantic versioning based on actual compatibility

What’s the real cost of poor contract testing?

Based on our analysis of 3,000+ bugs:

  • 27% of production issues stem from contract mismatches
  • Average resolution time increases 3x for contract-related bugs
  • Team productivity drops significantly during integration phases

How do you measure success in API development?

Track these key metrics:

  • Cycle time for feature delivery
  • Flow efficiency (active work vs. waiting time)
  • Contract-related bug frequency
  • Time spent in integration testing

More to explore