Created
April 14, 2026 22:12
-
-
Save kinlane/539287e1daa49c8fd620ba2e23de6e95 to your computer and use it in GitHub Desktop.
Path & Parameter Normalizer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| naftiko: "0.5" | |
| info: | |
| label: "Path & Parameter Normalizer" | |
| description: "Consumes three microservices that each use different naming conventions for paths and parameters — camelCase, snake_case, and PascalCase — and exposes a single HTTP adapter with normalized kebab-case paths and snake_case parameters." | |
| capability: | |
| exposes: | |
| - type: "http" | |
| namespace: "customers" | |
| baseUri: "http://localhost:8080" | |
| resources: | |
| - name: "customer-orders" | |
| label: "Customer Orders" | |
| description: "Retrieves recent orders for a customer, normalized from a camelCase upstream." | |
| path: "/customers/{customer_id}/orders" | |
| operations: | |
| - name: "list-orders" | |
| method: "GET" | |
| label: "List Customer Orders" | |
| inputParameters: | |
| - name: customer_id | |
| in: path | |
| type: string | |
| - name: page_size | |
| in: query | |
| type: integer | |
| steps: | |
| - name: fetch-orders | |
| type: call | |
| call: "orders-svc.getRecentOrders" | |
| with: | |
| customerId: "{{customer_id}}" | |
| pageSize: "{{page_size}}" | |
| outputParameters: | |
| - name: order_id | |
| type: string | |
| mapping: "{{fetch-orders.orderId}}" | |
| - name: order_total | |
| type: number | |
| mapping: "{{fetch-orders.orderTotal}}" | |
| - name: created_at | |
| type: string | |
| mapping: "{{fetch-orders.createdAt}}" | |
| - name: "product-details" | |
| label: "Product Details" | |
| description: "Returns product information, normalized from a snake_case upstream." | |
| path: "/products/{product_id}" | |
| operations: | |
| - name: "get-product" | |
| method: "GET" | |
| label: "Get Product" | |
| inputParameters: | |
| - name: product_id | |
| in: path | |
| type: string | |
| - name: include_variants | |
| in: query | |
| type: boolean | |
| steps: | |
| - name: fetch-product | |
| type: call | |
| call: "catalog-svc.get_product_details" | |
| with: | |
| product_id: "{{product_id}}" | |
| include_variants: "{{include_variants}}" | |
| outputParameters: | |
| - name: product_id | |
| type: string | |
| mapping: "{{fetch-product.product_id}}" | |
| - name: display_name | |
| type: string | |
| mapping: "{{fetch-product.display_name}}" | |
| - name: unit_price | |
| type: number | |
| mapping: "{{fetch-product.unit_price}}" | |
| - name: "shipping-estimate" | |
| label: "Shipping Estimate" | |
| description: "Returns a shipping estimate, normalized from a PascalCase upstream." | |
| path: "/shipments/{shipment_id}/estimate" | |
| operations: | |
| - name: "get-estimate" | |
| method: "GET" | |
| label: "Get Shipping Estimate" | |
| inputParameters: | |
| - name: shipment_id | |
| in: path | |
| type: string | |
| - name: postal_code | |
| in: query | |
| type: string | |
| steps: | |
| - name: fetch-estimate | |
| type: call | |
| call: "shipping-svc.GetShipmentEstimate" | |
| with: | |
| ShipmentId: "{{shipment_id}}" | |
| PostalCode: "{{postal_code}}" | |
| outputParameters: | |
| - name: estimated_days | |
| type: integer | |
| mapping: "{{fetch-estimate.EstimatedDays}}" | |
| - name: shipping_cost | |
| type: number | |
| mapping: "{{fetch-estimate.ShippingCost}}" | |
| - name: carrier_name | |
| type: string | |
| mapping: "{{fetch-estimate.CarrierName}}" | |
| consumes: | |
| # Service 1: camelCase paths and parameters | |
| - type: "http" | |
| namespace: "orders-svc" | |
| baseUri: "https://orders.internal.example.com/api/v2" | |
| authentication: | |
| type: "bearer" | |
| token: "$secrets.orders_token" | |
| resources: | |
| - name: "recentOrders" | |
| label: "Recent Orders" | |
| description: "Upstream order service using camelCase conventions." | |
| path: "/customerOrders/{customerId}/recentItems" | |
| operations: | |
| - name: "getRecentOrders" | |
| method: "GET" | |
| label: "Get Recent Orders" | |
| inputParameters: | |
| - name: customerId | |
| in: path | |
| type: string | |
| - name: pageSize | |
| in: query | |
| type: integer | |
| outputParameters: | |
| - name: orderId | |
| type: string | |
| - name: orderTotal | |
| type: number | |
| - name: createdAt | |
| type: string | |
| # Service 2: snake_case paths and parameters | |
| - type: "http" | |
| namespace: "catalog-svc" | |
| baseUri: "https://catalog.internal.example.com/api/v1" | |
| authentication: | |
| type: "bearer" | |
| token: "$secrets.catalog_token" | |
| resources: | |
| - name: "product_details" | |
| label: "Product Details" | |
| description: "Upstream catalog service using snake_case conventions." | |
| path: "/product_catalog/{product_id}/full_details" | |
| operations: | |
| - name: "get_product_details" | |
| method: "GET" | |
| label: "Get Product Details" | |
| inputParameters: | |
| - name: product_id | |
| in: path | |
| type: string | |
| - name: include_variants | |
| in: query | |
| type: boolean | |
| outputParameters: | |
| - name: product_id | |
| type: string | |
| - name: display_name | |
| type: string | |
| - name: unit_price | |
| type: number | |
| # Service 3: PascalCase paths and parameters | |
| - type: "http" | |
| namespace: "shipping-svc" | |
| baseUri: "https://shipping.internal.example.com/Api/V3" | |
| authentication: | |
| type: "bearer" | |
| token: "$secrets.shipping_token" | |
| resources: | |
| - name: "ShipmentEstimate" | |
| label: "Shipment Estimate" | |
| description: "Upstream shipping service using PascalCase conventions." | |
| path: "/ShipmentTracking/{ShipmentId}/DeliveryEstimate" | |
| operations: | |
| - name: "GetShipmentEstimate" | |
| method: "GET" | |
| label: "Get Shipment Estimate" | |
| inputParameters: | |
| - name: ShipmentId | |
| in: path | |
| type: string | |
| - name: PostalCode | |
| in: query | |
| type: string | |
| outputParameters: | |
| - name: EstimatedDays | |
| type: integer | |
| - name: ShippingCost | |
| type: number | |
| - name: CarrierName | |
| type: string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment