Contract Mapping

Home / Contract Mapping

API Contract Mapping for Spec‑Less Gateways

Kong, kgateway and APISIX route traffic without OpenAPI contracts, leaving imported APIs with incomplete definitions. DigitalAPI matches each route to its contract from repositories, Postman, SwaggerHub or ZIP uploads. Rule-based matching runs first, followed by AI, with uncertain matches flagged for human review.

Trusted by
Trusted by API teams at cloud-first companies

Definition

What Is API Contract Mapping?

API contract mapping pairs an API that a gateway serves with the contract that describes it. Gateways such as Kong, kgateway and APISIX hold routes and services but no OpenAPI contract, so the contract has to come from wherever your teams keep it.

In the DigitalAPI API Marketplace, mapping contracts is one of the six steps every gateway connector covers, between importing products and issuing keys.

The problem

Why Do Spec-Less Gateway Imports Arrive as Outlines?

A gateway import can only bring what the gateway holds. For Kong services, kgateway routes and APISIX routes, that is a name and a path, not the operations and schemas developers need.

Without mappingImported from Kong
Kong
payments-serviceRoute /payments/*
OperationsNot in the gateway
SchemasNot in the gateway
ContractNone
With mappingSame import, contract bound
Kong
Payments APIContract payments.yaml · GitHub
GET/payments/{id}
POST/payments
POST/payments/{id}/refunds
SchemasFrom the contract
APIs with no specKong serviceskgateway routesAPISIX routes

Contract sources

Where Can Your Contracts Come From?

Each gateway connection records where its contracts live, so mapping reads from the systems your teams already use. Contract files rarely arrive tidy, so the import also handles messy bundles:

  • Several API documents in one file
  • YAML saved with a .json extension
  • A file that is just a list of links
GitHubGitHubRepository
BitbucketBitbucketRepository
Azure ReposAzure ReposRepository
PostmanPostmanWorkspace
SwaggerHubSwaggerHubAPI registry
Zip uploadSpec files

How matching works

How Does Two-Stage Matching Pair Routes With Contracts?

Rules settle the obvious cases quickly. Only what they leave over goes to AI, and AI has to show its working.

Stage 1 · Rules
/orders↔orders-api.yaml
Routeexact match✓
Nameexact match✓
Bound on import
01

Rules score routes and names exactly

Routes and names on both sides are scored first. Clear pairs are settled here, quickly, before any AI is involved.

Stage 2 · AI on the leftovers
/v2/customers↔Customer API v2
Proposed pairing

Confidence: high

Reason: both sides describe the same customer operations under /v2

02

AI reads both sides, then states its confidence

For routes the rules could not settle, AI reads the route and the candidate contracts, proposes a pairing and must give its confidence and its reason.

✓

Confident pairs bind on import

The contract is attached as each API is imported, so the listing arrives complete.

?

The rest wait for review

Anything below the confidence bar goes to a review screen with its score and reason.

R

No AI provider? Rules run alone

Matching still runs on rules when no AI provider is configured.

Review

What Does a Person Review Before a Contract Is Bound?

AI never attaches a contract unattended when it is unsure. The reviewer sees the proposal and the reasoning, and decides.

01

A score on every proposal

So the reviewer knows how sure the match was before looking closer.

02

The reason in plain words

Every AI proposal states why it paired the two, so the check is quick.

03

The person decides

Pairs below the confidence bar are never attached until someone approves them.

04

More than one contract

One listing can take several contracts when an API is split across files.

How we compare

How Does DigitalAPI Compare to the Alternatives?

Without contract mapping, teams either publish what the gateway holds or copy a contract onto each listing by hand.

CapabilityPublish what the gateway holdsAttach contracts by hand
Spec-less routes in the catalogueComplete listings with contractsName and path onlyComplete, one API at a time
Where contracts come fromRepos, Postman, SwaggerHub or a zipNowhereCopied in by whoever does it
Obvious pairsSettled by rules on importNot pairedPaired by hand
Uncertain pairsAI proposal with confidence and reasonNot pairedDepends on who checks
Wrong contract attached unattendedNever below the confidence barNot applicablePossible, no second check

Frequently asked questions

API Contract Mapping FAQs

What is API contract mapping?

+

API contract mapping pairs an API that a gateway serves with the contract that describes it. In the DigitalAPI API Marketplace it turns gateway APIs that carry no specification into complete listings, with their operations and schemas taken from the contract.

Which gateways need contract mapping?

+

Gateways that route traffic without holding an OpenAPI contract, such as Kong services, kgateway routes and APISIX routes. Without mapping, imports from them arrive as outlines with a name and a path.

Where can contracts be imported from?

+

Each gateway connection records where its contracts live: a repository on GitHub, Bitbucket or Azure Repos, a Postman workspace, SwaggerHub, or an uploaded zip of spec files. Messy bundles are handled too, such as several documents in one file, YAML saved as JSON, or a list of links.

How does DigitalAPI match routes to contracts?

+

In two stages. Rules score routes and names first, which settles the obvious cases quickly. Only the leftovers go to AI, which reads both sides, proposes a pairing and must state its confidence and its reason.

Could AI attach the wrong contract?

+

Not unattended. Confident pairs are bound automatically as each API is imported. Anything below the confidence bar waits on a review screen with its score and reasoning, and a person decides.

Do we need an AI provider to use contract mapping?

+

No. Without an AI provider the rules run alone.

Can one API listing have more than one contract?

+

Yes. One listing can take several contracts, for example when an API is described across more than one file.

How does contract mapping relate to gateway connectors?

+

It is one of the six lifecycle steps every DigitalAPI gateway connector covers: connect and test, import APIs, import products, map contracts, issue keys and collect usage. Runtime traffic and keys stay on your gateway.

Get started

Turn Spec-Less Routes Into Complete API Listings

Book a 20-minute mapping review. Bring one Kong, kgateway or APISIX gateway and the place its contracts live, and we'll show how its routes would be matched and what would wait for review.

TALK WITH OUR EXPERT
AJK→