@@ -13,6 +13,9 @@ const parser = new RefParser()
1313const refs = {
1414 "ory://tracing-config" : `https://raw.githubusercontent.com/ory/x/master/otelx/config.schema.json` ,
1515 "ory://logging-config" : `https://raw.githubusercontent.com/ory/x/master/logrusx/config.schema.json` ,
16+ "ory://serve-config" : `https://raw.githubusercontent.com/ory/x/master/configx/serve.schema.json` ,
17+ "ory://cors-config" : `https://raw.githubusercontent.com/ory/x/master/configx/cors.schema.json` ,
18+ "ory://tls-config" : `https://raw.githubusercontent.com/ory/x/master/configx/tls.schema.json` ,
1619}
1720
1821const enhance =
@@ -113,7 +116,36 @@ const enhance =
113116export const oryResolver = {
114117 order : 1 ,
115118 canRead : / ^ o r y : / i,
116- read : ( { url } ) => axios . get ( refs [ url ] ) . then ( ( { data } ) => data ) ,
119+ read : ( { url } ) =>
120+ axios . get ( refs [ url ] ) . then ( ( { data } ) => {
121+ // Manually resolve internal $refs for schemas that have this issue
122+ const resolveInternalRefs = ( obj , definitions ) => {
123+ if ( typeof obj === "object" && obj !== null ) {
124+ for ( const key in obj ) {
125+ if (
126+ key === "$ref" &&
127+ typeof obj [ key ] === "string" &&
128+ obj [ key ] . startsWith ( "#/definitions/" )
129+ ) {
130+ const defName = obj [ key ] . replace ( "#/definitions/" , "" )
131+ if ( definitions && definitions [ defName ] ) {
132+ // Replace the $ref with the actual definition
133+ delete obj [ "$ref" ]
134+ Object . assign ( obj , definitions [ defName ] )
135+ }
136+ } else if ( typeof obj [ key ] === "object" ) {
137+ resolveInternalRefs ( obj [ key ] , definitions )
138+ }
139+ }
140+ }
141+ }
142+
143+ if ( data . definitions ) {
144+ resolveInternalRefs ( data , data . definitions )
145+ }
146+
147+ return data
148+ } ) ,
117149}
118150
119151export default function ConfigMarkdown ( props : { src : string ; binary : string } ) {
@@ -132,6 +164,10 @@ export default function ConfigMarkdown(props: { src: string; binary: string }) {
132164 . then ( ( r ) => r . json ( ) )
133165 . then ( ( schema ) => {
134166 new Promise ( ( resolve , reject ) => {
167+ if ( schema . title === "ORY Oathkeeper Configuration" ) {
168+ schema [ "$id" ] =
169+ "https://github.com/ory/oathkeeper/schema/config.schema.json"
170+ }
135171 parser . dereference (
136172 schema ,
137173 {
0 commit comments