@scalar/types
Version:
Types to work with Scalar packages
136 lines • 3.97 kB
TypeScript
/**
* This file is autogenerated. Do not edit it.
*
* Generated at: 2026-05-20T20:41:54.922Z
*/
/**
* Configuration for a single badge in the x-badges extension.
*
* @example
* ```yaml
* name: Beta
* position: before
* color: "#ffcc00"
* ```
*/
export type XBadge = {
/** The text that displays in the badge. This is required for all badges. */
name: string;
/** The position of the badge in relation to the header. Defaults to `after` when omitted. */
position?: 'before' | 'after';
/** The color of the badge in various formats (keywords, RGB, RGBA, HSL, HSLA, Hexadecimal) */
color?: string;
};
/**
* Badges for an operation in the Scalar UI. Use as visual indicators in documentation.
*
* @example
* ```yaml
* x-badges:
* - name: Alpha
* - name: Beta
* position: before
* ```
*/
export type XBadges = {
/** Badges displayed for this operation in documentation */
'x-badges'?: XBadge[];
};
/** A single code sample for documentation or examples */
export type XCodeSample = {
/** Programming language for syntax highlighting */
lang?: string;
/** Label shown in the code sample picker */
label?: string;
/** Source code for the sample */
source: string;
};
/**
* Code samples attached to an operation. Supports `x-codeSamples`, `x-code-samples`, and `x-custom-examples`.
*
* @example
* ```yaml
* x-code-samples:
* - lang: curl
* label: cURL
* source: curl https://api.example.com
* ```
*/
export type XCodeSamples = {
/** Code samples (camelCase spelling) */
'x-codeSamples'?: XCodeSample[];
/** Code samples (kebab-case spelling) */
'x-code-samples'?: XCodeSample[];
/** Custom code examples for the operation */
'x-custom-examples'?: XCodeSample[];
};
/**
* Draft example identifiers for an operation (in-progress examples not yet committed).
*
* @example
* ```yaml
* x-draft-examples:
* - default
* - error-case
* ```
*/
export type XDraftExamples = {
/** Identifiers of draft examples attached to this operation */
'x-draft-examples'?: string[];
};
/** Disabled parameter state by category and example */
export type DisableParametersConfig = {
/** Disabled state for global cookie parameters across examples */
'global-cookies'?: Record<string, Record<string, boolean>>;
/** Disabled state for global header parameters across examples */
'global-headers'?: Record<string, Record<string, boolean>>;
/** Disabled state for default header parameters across examples */
'default-headers'?: Record<string, Record<string, boolean>>;
};
/**
* Tracks which parameters are disabled across examples in the API client.
*
* Structure: category (global-cookies, global-headers, default-headers) → example key → parameter name → true if disabled.
*
* @example
* ```json
* {
* "x-scalar-disable-parameters": {
* "default-headers": {
* "default": { "Content-Type": true, "Accept": false }
* }
* }
* }
* ```
*/
export type XScalarDisableParameters = {
/** Disabled parameter state organized by category, example, and parameter name */
'x-scalar-disable-parameters'?: DisableParametersConfig;
};
/**
* Selected content type per example for request or response bodies. Keys are example names; values are media types.
*
* @example
* ```yaml
* x-scalar-selected-content-type:
* default: application/json
* xml-example: application/xml
* ```
*/
export type XScalarSelectedContentType = {
/** Map of example name to selected content type (for example `application/json`) */
'x-scalar-selected-content-type'?: Record<string, string>;
};
/**
* Indicates the stability of an operation in the Scalar UI.
*
* @example
* ```yaml
* x-scalar-stability: deprecated
* ```
*/
export type XScalarStability = {
/** Stability level: `deprecated`, `experimental`, or `stable` */
'x-scalar-stability'?: 'deprecated' | 'experimental' | 'stable';
};
//# sourceMappingURL=index.d.ts.map