The dynamicSlippage parameter in swagger.yaml is currently defined as boolean, but according to the Jupiter API documentation, it should accept an object with a maxBps property for configurable dynamic slippage.
Current Problem
In swagger.yaml, the SwapRequest schema defines:
dynamicSlippage:
type: boolean
This generates TypeScript definitions like:
dynamicSlippage?: boolean;
However, developers trying to use the documented object format get TypeScript errors:
// This should work according to docs but causes TS error
dynamicSlippage: {
maxBps: 50, // Maximum slippage in basis points
}
// Error: Type '{ maxBps: number; }' is not assignable to type 'boolean | undefined'
Expected Behavior
The API should accept an object with maxBps property for configurable dynamic slippage with maximum cap.
Proposed Fix
Update the swagger.yaml file to define dynamicSlippage as:
dynamicSlippage:
type: object
properties:
maxBps:
type: integer
description: Maximum slippage in basis points
example: 50
This will generate the correct TypeScript definition:
dynamicSlippage?: { maxBps: number };
Files to Update
- Primary:
swagger.yaml - Update the OpenAPI specification
- Secondary: Regenerate TypeScript definitions using the OpenAPI tools configured in
openapitools.json
Steps to Reproduce
- Install
@jup-ag/api@6.0.44
- Try to use
dynamicSlippage as an object:
const swapObj = await jupiterQuoteApi.swapPost({
swapRequest: {
quoteResponse: quote,
userPublicKey: publicKey.toBase58(),
dynamicSlippage: {
maxBps: 50,
},
// ... other properties
},
});
- Observe TypeScript error
Current Workaround
Developers must use unsafe type assertions:
dynamicSlippage: {
maxBps: 50,
} as any,
Environment
- Package:
@jup-ag/api@6.0.44
- TypeScript: Latest
- Issue affects all TypeScript users of the package
Impact
This affects all TypeScript developers using the @jup-ag/api package who want to implement configurable dynamic slippage as documented in the official API documentation. The current type definitions force developers to abandon TypeScript safety or avoid using this feature entirely.
Additional Context
The Jupiter API documentation clearly shows examples using the object format with maxBps, but the generated TypeScript definitions don't match the actual API capabilities. This creates confusion and forces developers to use workarounds that bypass TypeScript's type safety.
The
dynamicSlippageparameter inswagger.yamlis currently defined asboolean, but according to the Jupiter API documentation, it should accept an object with amaxBpsproperty for configurable dynamic slippage.Current Problem
In
swagger.yaml, theSwapRequestschema defines:This generates TypeScript definitions like:
However, developers trying to use the documented object format get TypeScript errors:
Expected Behavior
The API should accept an object with
maxBpsproperty for configurable dynamic slippage with maximum cap.Proposed Fix
Update the
swagger.yamlfile to definedynamicSlippageas:This will generate the correct TypeScript definition:
Files to Update
swagger.yaml- Update the OpenAPI specificationopenapitools.jsonSteps to Reproduce
@jup-ag/api@6.0.44dynamicSlippageas an object:Current Workaround
Developers must use unsafe type assertions:
Environment
@jup-ag/api@6.0.44Impact
This affects all TypeScript developers using the
@jup-ag/apipackage who want to implement configurable dynamic slippage as documented in the official API documentation. The current type definitions force developers to abandon TypeScript safety or avoid using this feature entirely.Additional Context
The Jupiter API documentation clearly shows examples using the object format with
maxBps, but the generated TypeScript definitions don't match the actual API capabilities. This creates confusion and forces developers to use workarounds that bypass TypeScript's type safety.