OpenAPI Mapping Reference
Complete reference for type and construct mappings between OpenAPI specifications and Pulse IDL.
Type Mapping Tables
Primitive Types
OpenAPI to Pulse
| OpenAPI Type | Format | Pulse Type | Notes |
|---|---|---|---|
string |
- | string |
Direct mapping |
integer |
int32 |
int |
Pulse int is 64-bit |
integer |
int64 |
int |
Direct mapping |
number |
float |
float |
Pulse float is double precision |
number |
double |
float |
Direct mapping |
boolean |
- | bool |
Direct mapping |
Pulse to OpenAPI
| Pulse Type | OpenAPI Type | Format |
|---|---|---|
string |
string |
- |
int |
integer |
int64 |
float |
number |
double |
bool |
boolean |
- |
Complex Types
OpenAPI to Pulse
| OpenAPI Schema | Pulse Type | Example |
|---|---|---|
type: array |
[]Type |
[]string |
type: object with properties |
struct |
See struct mapping |
type: object with additionalProperties |
map[string]Type |
map[string]string |
type: string with enum |
enum |
See enum mapping |
allOf with single ref + object |
struct with extends |
See inheritance |
nullable: true |
Field marked [optional] |
See optional fields |
Pulse to OpenAPI
| Pulse Type | OpenAPI Schema | Example |
|---|---|---|
[]Type |
type: array with items |
{"type": "array", "items": {"type": "string"}} |
map[string]Type |
type: object with additionalProperties |
{"type": "object", "additionalProperties": {"type": "string"}} |
enum |
type: string with enum array |
{"type": "string", "enum": ["a", "b"]} |
struct with extends |
allOf composition |
See inheritance |
[optional] field |
Not in required array |
See optional fields |
Struct Mapping
OpenAPI to Pulse
OpenAPI Schema:
components:
schemas:
User:
type: object
required:
- id
- name
properties:
id:
type: integer
format: int64
name:
type: string
email:
type: string
Generated Pulse IDL:
struct User {
id int
name string
email string [optional]
}
Rules:
- Schema
titleor schema name becomes struct name requiredarray determines[optional]annotations- Property names are converted to camelCase
descriptionfield becomes doc commentnullable: trueadds[optional]annotation
Pulse to OpenAPI
Pulse IDL:
// User represents a user account
struct User {
userId string
firstName string
lastName string
email string [optional]
}
Generated OpenAPI Schema:
components:
schemas:
User:
description: User represents a user account
type: object
properties:
userId:
type: string
firstName:
type: string
lastName:
type: string
email:
type: string
required:
- userId
- firstName
- lastName
Rules:
- Struct name becomes schema name
- Fields without
[optional]are inrequiredarray - IDL comments become
descriptionfields - Field names preserve original casing
Enum Mapping
OpenAPI to Pulse
OpenAPI Schema:
components:
schemas:
Status:
type: string
enum:
- active
- inactive
- pending
description: User account status
Generated Pulse IDL:
// User account status
enum Status {
active
inactive
pending
}
Rules:
- Only
type: stringenums are supported - Enum values are converted to valid Pulse identifiers
descriptionfield becomes doc comment- Numeric enums are converted to struct with const values (warning issued)
Pulse to OpenAPI
Pulse IDL:
// Order status enumeration
enum OrderStatus {
pending
paid
shipped
delivered
cancelled
}
Generated OpenAPI Schema:
components:
schemas:
OrderStatus:
description: Order status enumeration
type: string
enum:
- pending
- paid
- shipped
- delivered
- cancelled
Rules:
- All Pulse enums map to
type: string - Enum values preserve original casing
- IDL comments become
descriptionfields
Inheritance (extends)
OpenAPI to Pulse
OpenAPI Schema:
components:
schemas:
Animal:
type: object
required:
- name
properties:
name:
type: string
Dog:
allOf:
- $ref: '#/components/schemas/Animal'
- type: object
required:
- breed
properties:
breed:
type: string
Generated Pulse IDL:
struct Animal {
name string
}
struct Dog extends Animal {
breed string
}
Rules:
allOfwith exactly one$ref+ object maps toextendsallOfwith multiple$refs issues warning (uses first)allOfwith no$refs issues warning (flattens properties)- Order is preserved: parent types before child properties
Pulse to OpenAPI
Pulse IDL:
struct Animal {
name string
}
struct Dog extends Animal {
breed string
}
Generated OpenAPI Schema:
components:
schemas:
Animal:
type: object
properties:
name:
type: string
required:
- name
Dog:
allOf:
- $ref: '#/components/schemas/Animal'
- type: object
properties:
breed:
type: string
required:
- breed
Rules:
extendskeyword maps toallOfcomposition- Parent struct is first item in
allOfarray - Child properties are in second
allOfitem
Optional Fields
OpenAPI to Pulse
Fields are optional in Pulse when:
- Not in the
requiredarray - Marked with
nullable: true
OpenAPI Schema:
components:
schemas:
User:
type: object
required:
- id
properties:
id:
type: string
name:
type: string
nullable: true
email:
type: string
Generated Pulse IDL:
struct User {
id string
name string [optional]
email string [optional]
}
Pulse to OpenAPI
Fields with [optional] are excluded from the required array.
Pulse IDL:
struct User {
userId string
email string [optional]
}
Generated OpenAPI Schema:
components:
schemas:
User:
type: object
properties:
userId:
type: string
email:
type: string
required:
- userId
Interface and Method Mapping
OpenAPI to Pulse
Interface Grouping
Operations are grouped into interfaces by:
- Primary: First tag in
tagsarray - Fallback: Path prefix (e.g.,
/pets/*→petsinterface)
OpenAPI Paths:
paths:
/pets:
get:
operationId: listPets
tags:
- pets
responses:
'200':
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
/pets/{id}:
get:
operationId: getPet
tags:
- pets
parameters:
- name: id
in: path
required: true
schema:
type: string
Generated Pulse IDL:
interface pets {
getListPets() []listPetsResponse_item
getShowPetById(petId string) showPetByIdResponse_item
}
Method Naming
Method names follow the pattern: {httpMethod}{operationId}
| HTTP Method | Prefix | Example operationId | Method Name |
|---|---|---|---|
| GET | get |
listPets |
getListPets |
| POST | post |
createPet |
postCreatePet |
| PUT | put |
updatePet |
putUpdatePet |
| DELETE | delete |
deletePet |
deleteDeletePet |
| PATCH | patch |
patchPet |
patchPatchPet |
If operationId is missing, it’s derived from the path:
/pets/{id}→getPetsById
Parameter Mapping
All parameters become method parameters:
| OpenAPI Parameter In | Pulse Parameter |
|---|---|
path |
Named parameter (e.g., id string) |
query |
Named parameter (e.g., limit int) |
header |
Dropped with warning |
cookie |
Dropped with warning |
Request Body Mapping
Request body becomes a parameter named after the operation or body:
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewPet'
Becomes:
postCreatePet(createPetBody NewPet) ...
Response Mapping
Success responses determine return type:
| Response Code | Behavior |
|---|---|
| 200 | Use schema as return type |
| 201 | Use schema as return type |
| 204 | Return type is [optional] |
| default | Used if 200/201 not present |
Pulse to OpenAPI
Path Generation
Each interface method becomes a POST endpoint:
Pattern: POST /{interface}/{method}
Pulse IDL:
interface UserService {
getUser(userId string) User
createUser(user CreateUserRequest) User
}
Generated Paths:
paths:
/UserService/getUser:
post:
operationId: UserService_getUser
tags:
- UserService
requestBody:
# ... userId parameter
responses:
'200':
# ... User schema
/UserService/createUser:
post:
operationId: UserService_createUser
tags:
- UserService
requestBody:
# ... user parameter
responses:
'200':
# ... User schema
operationId Format
Format: {interface}_{method}
Examples:
UserService.getUser→UserService_getUserOrderService.placeOrder→OrderService_placeOrder
Tags
Each Pulse interface becomes an OpenAPI tag:
Pulse IDL:
interface CatalogService { }
interface CartService { }
Generated Tags:
tags:
- name: CatalogService
description: Pulse interface: CatalogService
- name: CartService
description: Pulse interface: CartService
Namespace Mapping
OpenAPI to Pulse
Namespace is derived from info.title:
- Convert to lowercase
- Replace non-alphanumeric characters with underscores
- Ensure valid identifier
Examples:
info.title |
Generated Namespace |
|---|---|
Petstore API |
petstore_api |
My-Great Service |
my_great_service |
API123 |
api123 |
Pulse to OpenAPI
info.title is derived from namespace:
Pulse IDL:
namespace my_service
Generated OpenAPI:
info:
title: My_Service
description: |
Namespace: my_service
Interfaces: 2
Structs: 5
Enums: 1
Warning Conditions
OpenAPI to Pulse Warnings
| Condition | Warning | Fallback |
|---|---|---|
oneOf encountered |
“oneOf encountered at {path} (using first type)” | First schema type |
anyOf encountered |
“anyOf encountered at {path} (using first type)” | First schema type |
allOf with multiple refs |
“allOf with multiple $ref at {path} (using first)” | First $ref |
| Header parameter | “header parameter ‘{name}’ dropped” | Parameter ignored |
| Cookie parameter | “cookie parameter ‘{name}’ dropped” | Parameter ignored |
| Non-2xx response | “response code {code} dropped” | Response ignored |
| Security scheme | “security scheme ‘{name}’ dropped” | Scheme ignored |
| Binary format | “binary format not supported at {path}” | Error |
Pulse to OpenAPI Warnings
| Condition | Warning |
|---|---|
| Reserved word conflict | “parameter ‘{name}’ conflicts with OpenAPI reserved word” |
Circular Reference Handling
OpenAPI to Pulse
Circular references are detected and broken with [optional]:
OpenAPI Schema:
components:
schemas:
Node:
type: object
properties:
value:
type: string
next:
$ref: '#/components/schemas/Node'
Generated Pulse IDL:
struct Node {
value string
next Node [optional] // [optional] breaks circular reference
}
Warning Issued:
Warning: circular reference detected at #/components/schemas/Node/next (breaking with [optional])
Examples
See the OpenAPI Examples directory for complete working examples:
petstore.yaml- Standard Petstore OpenAPI 3.0 specpetstore.pulse- Generated Pulse IDLsimple-api.pulse- Simple Pulse IDL for round-trip testingsimple-api.openapi.yaml- Generated OpenAPI spec