Something went wrong. Try again.
fork of hey-api/openapi-ts because I need some additional things
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637import type { NodeName } from '@hey-api/codegen-core';
import { py } from '../../py-compiler';import type { MaybePyDsl } from '../base';import { PyDsl } from '../base';
export type KwargValue = string | number | boolean | null | MaybePyDsl<py.Expression>;
export class KwargPyDsl extends PyDsl<py.KeywordArgument> { readonly '~dsl' = 'KwargPyDsl';
protected _value: KwargValue;
constructor(name: NodeName, value: KwargValue) { super(); this.name.set(name); this._value = value; }
override toAst() { const name = this.name.toString(); return py.factory.createKeywordArgument(name, this.$valueToNode(this._value)); }
private $valueToNode(value: KwargValue) { if ( typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean' || value === null ) { return py.factory.createLiteral(value); } return this.$node(value); }}