diff --git a/modelina-website/src/components/contexts/PlaygroundContext.tsx b/modelina-website/src/components/contexts/PlaygroundContext.tsx index 10a4cda926..c513634783 100644 --- a/modelina-website/src/components/contexts/PlaygroundContext.tsx +++ b/modelina-website/src/components/contexts/PlaygroundContext.tsx @@ -63,6 +63,7 @@ export const PlaygroundContextProvider: React.FC<{ children: React.ReactNode; }> tsMarshalling: false, tsModelType: 'class', tsEnumType: 'enum', + tsMapType: 'map', tsModuleSystem: 'CJS', tsIncludeDescriptions: false, tsIncludeExampleFunction: false, diff --git a/modelina-website/src/components/playground/Playground.tsx b/modelina-website/src/components/playground/Playground.tsx index a078dd7d9c..7efb15fc00 100644 --- a/modelina-website/src/components/playground/Playground.tsx +++ b/modelina-website/src/components/playground/Playground.tsx @@ -86,6 +86,9 @@ const Playground: React.FC = (props) => { if (query.tsEnumType !== undefined) { setConfig({ ...config, tsEnumType: query.tsEnumType as any }); } + if (query.tsMapType !== undefined) { + setConfig({ ...config, tsMapType: query.tsMapType as any }); + } if (query.tsIncludeDescriptions !== undefined) { setConfig({ ...config, tsIncludeDescriptions: query.tsIncludeDescriptions === 'true' }); } diff --git a/modelina-website/src/components/playground/options/TypeScriptGeneratorOptions.tsx b/modelina-website/src/components/playground/options/TypeScriptGeneratorOptions.tsx index 240f5e918a..0e3b9c3889 100644 --- a/modelina-website/src/components/playground/options/TypeScriptGeneratorOptions.tsx +++ b/modelina-website/src/components/playground/options/TypeScriptGeneratorOptions.tsx @@ -35,6 +35,10 @@ const TypeScriptGeneratorOptions: React.FC = ({ setNewConfig && setNewConfig('tsEnumType', enumType); }; + const onChangeMapType = (mapType: string) => { + setNewConfig && setNewConfig('tsMapType', mapType); + }; + const onChangeIncludeJsonBinPack = (event: React.ChangeEvent) => { if (setNewConfig) { const shouldIncludeMarshalling = context?.tsMarshalling === false && event.target.checked === true; @@ -101,6 +105,30 @@ const TypeScriptGeneratorOptions: React.FC = ({ /> +
  • + +

    + It indicates which type should be rendered for some map type. Its value can be either map, indexedObject, or record. +

    + The default value is map. +

    +
    +