No autocompletion when using JSON Schema with external ref

No autocompletion when using JSON Schema with external ref

Environment

- IDE: WebStorm 2025.1 (Build #WS-251.23774.424, built on April 14, 2025)

Issue Description

I'm experiencing an issue with code autocomplete when using JSON Schema with an external ref inside. Please check the minimal steps to reproduce for more details.

Steps to Reproduce

1. Create a data.json file with:

{
  "data": [""]
}

2. Create a mySchema.schema.json file with:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Data",
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "$ref": "externalSchema.schema.json#/definitions/DataType"
      }
    }
  }
}

3. Create a externalSchema.schema.json file with:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "ExternalSchema",
  "definitions": {
    "DataType": {
      "type": "string",
      "enum": [
        "DATA_1",
        "DATA_2"
      ]
    }
  }
}

4. Go to Settings > Languages & Frameworks > Schemas and DTDs > JSON Schema Mappings and add mySchema.schema.json as schema with the data.json file as mapping.

Expected Behavior

Auto complete suggesting "DATA_1" and “DATA_2” in the empty string in data.json

Actual Behavior

No Auto complete.

What I've Tried

I've already attempted the following troubleshooting steps:
- Using the http://json-schema.org/draft-07/schema for both schemas
- Adding externalSchema.schema.json to the JSON Schema Mappings setting
- Adding  data.json file as mapping on externalSchema.schema.json gives a Warning: conflicting mappings and does not resolve the issue.
- Ctrl + Left Click on DataType in mySchema.schema.json does open externalSchema.schema.json correctly.
- Changing the mySchema.schema.json as follow does make the auto complete work, but removes the externalSchema:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Data",
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/DataType"
      }
    }
  },
  "definitions": {
    "DataType": {
      "type": "string",
      "enum": [
        "DATA_1",
        "DATA_2"
      ]
    }
  }
}

Related issues

https://intellij-support.jetbrains.com/hc/en-us/community/posts/360002856559-JSON-Schema-can-t-find-local-external-reference

https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000550290-JSON-Schema-editing-can-t-find-external-reference

Both did not resolve my issue.

Thank you for your help!
 

0
1 comment

Thank you for sharing all the details. The issue is tracked at IJPL-174586, please follow it for the updates.

1

Please sign in to leave a comment.