Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add an interactive playground to the documentation site #216

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mnahkies
Copy link
Owner

@mnahkies mnahkies commented Jun 2, 2024

Oh boy was this more of a pain than I expected. Creates an interactive playground similar to the typespec or typescript ones, based on https://github.com/microsoft/monaco-editor

Still pretty WIP and buggy

const fileRootPath = "file:///"
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
...monaco.languages.typescript.typescriptDefaults.getCompilerOptions(),
moduleResolution: 100 as any, //monaco.languages.typescript.ModuleResolutionKind.NodeJs,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raised microsoft/monaco-editor#4545 to expose these properly, though unfortunately even with 3 (Node16) I still see squiggly red lines unless I do the hack above to reorganize the files to the root of the module.

import {useMemo} from "react";

export const getStaticProps = ({params}) => {
const text = fs.readFileSync('/home/michael/projects/nahkies/npm-packages/openapi-code-generator/integration-tests-definitions/petstore-expanded.yaml', 'utf-8')
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: load all definitions, probably better to use a webpack loader

console.info("run generation")

generate(
{
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: make all options configurable in UI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant