File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
src/languageservice/services Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -279,7 +279,7 @@ export class YAMLSchemaService extends JSONSchemaService {
279
279
const handleRef = ( next : JSONSchema ) : void => {
280
280
const seenRefs = new Set ( ) ;
281
281
while ( next . $ref ) {
282
- const ref = next . $ref ;
282
+ const ref = decodeURIComponent ( next . $ref ) ;
283
283
const segments = ref . split ( '#' , 2 ) ;
284
284
//return back removed $ref. We lost info about referenced type without it.
285
285
next . _$ref = next . $ref ;
Original file line number Diff line number Diff line change @@ -2027,4 +2027,31 @@ obj:
2027
2027
[ 'Missing property "form".' ] // not inclide provider error
2028
2028
) ;
2029
2029
} ) ;
2030
+
2031
+ it ( 'URL-encoded characters in $ref' , async ( ) => {
2032
+ // note that 'missing form property' is necessary to trigger the bug (there has to be some problem in both subSchemas)
2033
+ // order of the object in `anyOf` is also important
2034
+ const schema : JSONSchema = {
2035
+ type : 'object' ,
2036
+ properties : {
2037
+ myProperty : {
2038
+ $ref : '#/definitions/Interface%3Ctype%3E' ,
2039
+ } ,
2040
+ } ,
2041
+ definitions : {
2042
+ 'Interface<type>' : {
2043
+ type : 'object' ,
2044
+ properties : {
2045
+ foo : {
2046
+ type : 'string' ,
2047
+ } ,
2048
+ } ,
2049
+ } ,
2050
+ } ,
2051
+ } ;
2052
+ schemaProvider . addSchema ( SCHEMA_ID , schema ) ;
2053
+ const content = `myProperty:\n foo: bar` ;
2054
+ const result = await parseSetup ( content ) ;
2055
+ assert . equal ( result . length , 0 ) ;
2056
+ } ) ;
2030
2057
} ) ;
You can’t perform that action at this time.
0 commit comments