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

export YAML functionalities #107

Open
vharny opened this issue May 31, 2024 · 8 comments
Open

export YAML functionalities #107

vharny opened this issue May 31, 2024 · 8 comments

Comments

@vharny
Copy link

vharny commented May 31, 2024

Hello,

Thank you for this library, I am really interested in validation / autocompletion JSON Schema YAML.

Currently in the package the functionalities concerning the JSON Schema for YAML are not exported.

Is there a reason why this has not yet been done?

@imolorhe
Copy link
Collaborator

The library already exports the validation and autocompletion options for YAML. You can access them via the/yaml path. You can see how it's used in the example in the repo.

@vharny
Copy link
Author

vharny commented May 31, 2024

With the version 0.7.3

Screenshot 2024-05-31 at 17 44 15
Screenshot 2024-05-31 at 17 45 13

I think the YAML methods are not correctly exported :/

@vharny
Copy link
Author

vharny commented May 31, 2024

It's probably a typescript problem with moduleResolution in the tsconfig but for an Angular 17 project for example the moduleResolution is node.

@vharny
Copy link
Author

vharny commented May 31, 2024

In my Angular project, if I want the import to work, I have to set the moduleResolution to Bundler.
I never have any problems with other libraries that have imports with a /

Cannot find module 'codemirror-json-schema/yaml' or its corresponding type declarations. There are types at '[...]/node_modules/codemirror-json-schema/dist/yaml/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.ts(2307)

@acao
Copy link
Collaborator

acao commented May 31, 2024

Yes I plan to take a look at and fix this this weekend!

@acao
Copy link
Collaborator

acao commented Jun 1, 2024

@vharny can you let me know if 0.7.5 works for you? it should match everything else in the cm6 ecosystem now in terms of bundling

@vharny
Copy link
Author

vharny commented Jun 3, 2024

Hello @acao,
Thanks for you quick response!

Sorry, it doesn't work :/
This is my tsconfig file:

{
  "compileOnSave": false,
  "compilerOptions": {
    "downlevelIteration": true,
    "incremental": true,
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "resolveJsonModule": true,
    "allowSyntheticDefaultImports": true,
    "target": "ES2022",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2020",
      "dom"
    ],
    "module": "esnext",
    "baseUrl": "./src",
    "useDefineForClassFields": false
  }
}

@vharny
Copy link
Author

vharny commented Jun 3, 2024

It works when I define paths in the tsconfig file:

"compilerOptions": {
  "baseUrl": "./src",
  ...
  "paths": {
        "codemirror-json-schema/yaml": ["../node_modules/codemirror-json-schema/dist/yaml"],
        ...
   }
 }

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

No branches or pull requests

3 participants