Skip to content

Commit

Permalink
[Enhancement] Improve support for circular $ref pointers (#154)
Browse files Browse the repository at this point in the history
* Add swagger property to OpenApiObject type

* Remove loadAndBundleSpec.ts

* Improve nested allOf, oneOf, anyOf support

* Add support for resolving circular  pointers

* Switch to createRows

* Extend oneOf/anyOf support

* Use 'circular()' as placeholder for circular refs

* Re-gen API docs

* Add oneOf to petType

* Re-gen petstore API docs

* Add minItems and maxItems qualifier

* Improve support for arrays

* Add titles to Pet and Tag models

* Re-gen API docs

* Handle arrays before properties

* Enclose decycled in try/catch

* Filter undefined items due to transient parsing errors
  • Loading branch information
sserrata committed Jul 14, 2022
1 parent ca833d8 commit fde4866
Show file tree
Hide file tree
Showing 78 changed files with 1,404 additions and 360 deletions.
2 changes: 1 addition & 1 deletion demo/docs/cos/create-a-bucket.api.mdx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/docs/cos/generating-an-iam-token.api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: generating-an-iam-token
sidebar_label: Generating an IAM token
hide_title: true
hide_table_of_contents: true
api: {"tags":["Authentication"],"description":"Generate an IBM Cloud® Identity and Access Management (IAM) token by using either your [IAM API key](https://cloud.ibm.com/docs/iam?topic=iam-userapikey#userapikey) or a [service ID's API key](https://cloud.ibm.com/docs/iam?topic=iam-serviceidapikeys#serviceidapikeys) IBM Cloud APIs can be accessed only by users who are authorized by an assigned IAM role.\nEach user who is calling the API must pass credentials for the API to authenticate.\n\nYou can generate an IAM token by using either your IBM Cloud API key or a service ID's API key.\nThe API key is a permanent credential that can be reused if you don't lose the API key value or delete the API key in the account.\nThis process is also used if you are developing an application that needs to work with other IBM Cloud services.\nYou must use a service ID API key to get an access token to be passed to each of the IBM Cloud services.\n\n:::note\nAn access token is a temporary credential that expires after 1 hour.\nAfter the acquired token expires, you must generate a new token to continue calling IBM Cloud or service APIs, and you can perform only actions that are allowed by your level of assigned access within all accounts.\n:::","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"grant_type":{"type":"string","enum":["urn:ibm:params:oauth:grant-type:apikey"]},"apikey":{"type":"string"}},"required":["grant_type","apikey"]}}},"required":true},"security":[{"//":[]}],"responses":{"200":{"description":"ok"}},"method":"post","path":"/identity/token","servers":[{"url":"https://s3.{region}.cloud-object-storage.appdomain.cloud","variables":{"region":{"enum":["us","eu","ap","us-south","us-east","eu-gb","eu-de","au-syd","jp-tok","ams03","che01","hkg02","mex01","mil01","mon01","osl01","par01","sjc04","sao01","seo01","sng01","tor01"],"default":"us"}}}],"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"},"BasicAuth":{"type":"http","scheme":"basic"}},"info":{"title":"Cloud Object Storage","version":"1.0.1"},"postman":{"name":"Generating an IAM token","description":{"content":"Generate an IBM Cloud® Identity and Access Management (IAM) token by using either your [IAM API key](https://cloud.ibm.com/docs/iam?topic=iam-userapikey#userapikey) or a [service ID's API key](https://cloud.ibm.com/docs/iam?topic=iam-serviceidapikeys#serviceidapikeys) IBM Cloud APIs can be accessed only by users who are authorized by an assigned IAM role.\nEach user who is calling the API must pass credentials for the API to authenticate.\n\nYou can generate an IAM token by using either your IBM Cloud API key or a service ID's API key.\nThe API key is a permanent credential that can be reused if you don't lose the API key value or delete the API key in the account.\nThis process is also used if you are developing an application that needs to work with other IBM Cloud services.\nYou must use a service ID API key to get an access token to be passed to each of the IBM Cloud services.\n\n:::note\nAn access token is a temporary credential that expires after 1 hour.\nAfter the acquired token expires, you must generate a new token to continue calling IBM Cloud or service APIs, and you can perform only actions that are allowed by your level of assigned access within all accounts.\n:::","type":"text/plain"},"url":{"path":["identity","token"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/x-www-form-urlencoded"}],"method":"POST","body":{"mode":"urlencoded","urlencoded":[]}}}
api: {"tags":["Authentication"],"description":"Generate an IBM Cloud® Identity and Access Management (IAM) token by using either your [IAM API key](https://cloud.ibm.com/docs/iam?topic=iam-userapikey#userapikey) or a [service ID's API key](https://cloud.ibm.com/docs/iam?topic=iam-serviceidapikeys#serviceidapikeys) IBM Cloud APIs can be accessed only by users who are authorized by an assigned IAM role.\nEach user who is calling the API must pass credentials for the API to authenticate.\n\nYou can generate an IAM token by using either your IBM Cloud API key or a service ID's API key.\nThe API key is a permanent credential that can be reused if you don't lose the API key value or delete the API key in the account.\nThis process is also used if you are developing an application that needs to work with other IBM Cloud services.\nYou must use a service ID API key to get an access token to be passed to each of the IBM Cloud services.\n\n:::note\nAn access token is a temporary credential that expires after 1 hour.\nAfter the acquired token expires, you must generate a new token to continue calling IBM Cloud or service APIs, and you can perform only actions that are allowed by your level of assigned access within all accounts.\n:::","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"grant_type":{"type":"string","enum":["urn:ibm:params:oauth:grant-type:apikey"]},"apikey":{"type":"string"}},"required":["grant_type","apikey"]}}},"required":true},"security":[{"//":[]}],"responses":{"200":{"description":"ok"}},"parameters":[],"method":"post","path":"/identity/token","servers":[{"url":"/"}],"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"},"BasicAuth":{"type":"http","scheme":"basic"}},"info":{"title":"Cloud Object Storage","version":"1.0.1"},"postman":{"name":"Generating an IAM token","description":{"content":"Generate an IBM Cloud® Identity and Access Management (IAM) token by using either your [IAM API key](https://cloud.ibm.com/docs/iam?topic=iam-userapikey#userapikey) or a [service ID's API key](https://cloud.ibm.com/docs/iam?topic=iam-serviceidapikeys#serviceidapikeys) IBM Cloud APIs can be accessed only by users who are authorized by an assigned IAM role.\nEach user who is calling the API must pass credentials for the API to authenticate.\n\nYou can generate an IAM token by using either your IBM Cloud API key or a service ID's API key.\nThe API key is a permanent credential that can be reused if you don't lose the API key value or delete the API key in the account.\nThis process is also used if you are developing an application that needs to work with other IBM Cloud services.\nYou must use a service ID API key to get an access token to be passed to each of the IBM Cloud services.\n\n:::note\nAn access token is a temporary credential that expires after 1 hour.\nAfter the acquired token expires, you must generate a new token to continue calling IBM Cloud or service APIs, and you can perform only actions that are allowed by your level of assigned access within all accounts.\n:::","type":"text/plain"},"url":{"path":["identity","token"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/x-www-form-urlencoded"}],"method":"POST","body":{"mode":"urlencoded","urlencoded":[]}}}
sidebar_class_name: "post api-method"
info_path: cos/cloud-object-storage
---
Expand Down
2 changes: 1 addition & 1 deletion demo/docs/cos/list-buckets.api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: list-buckets
sidebar_label: List buckets
hide_title: true
hide_table_of_contents: true
api: {"tags":["Bucket operations"],"description":"A `GET` request sent to the endpoint root returns a list of buckets that are associated with the specified service instance.\nFor more information about endpoints, see [Endpoints and storage locations](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-endpoints#endpoints).","parameters":[{"in":"query","name":"extended","description":"Provides `LocationConstraint` metadata in the listing.","required":false,"schema":{"type":"boolean"},"allowEmptyValue":true},{"name":"ibm-service-instance-id","in":"header","description":"List buckets that were created in this service instance.","required":true,"schema":{"type":"string"}}],"security":[{"BearerAuth":[]},{"BearerAuth":[],"BasicAuth":[]}],"responses":{"200":{"description":"ok"}},"method":"get","path":"/","servers":[{"url":"https://s3.{region}.cloud-object-storage.appdomain.cloud","variables":{"region":{"enum":["us","eu","ap","us-south","us-east","eu-gb","eu-de","au-syd","jp-tok","ams03","che01","hkg02","mex01","mil01","mon01","osl01","par01","sjc04","sao01","seo01","sng01","tor01"],"default":"us"}}}],"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"},"BasicAuth":{"type":"http","scheme":"basic"}},"info":{"title":"Cloud Object Storage","version":"1.0.1"},"postman":{"name":"List buckets","description":{"content":"A `GET` request sent to the endpoint root returns a list of buckets that are associated with the specified service instance.\nFor more information about endpoints, see [Endpoints and storage locations](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-endpoints#endpoints).","type":"text/plain"},"url":{"path":[""],"host":["{{baseUrl}}"],"query":[{"disabled":false,"description":{"content":"Provides `LocationConstraint` metadata in the listing.","type":"text/plain"},"key":"extended","value":""}],"variable":[]},"header":[{"disabled":false,"description":{"content":"(Required) List buckets that were created in this service instance.","type":"text/plain"},"key":"ibm-service-instance-id","value":""}],"method":"GET","auth":{"type":"bearer","bearer":[{"type":"any","value":"<Bearer Token>","key":"token"}]}}}
api: {"tags":["Bucket operations"],"description":"A `GET` request sent to the endpoint root returns a list of buckets that are associated with the specified service instance.\nFor more information about endpoints, see [Endpoints and storage locations](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-endpoints#endpoints).","parameters":[{"in":"query","name":"extended","description":"Provides `LocationConstraint` metadata in the listing.","required":false,"schema":{"type":"boolean"},"allowEmptyValue":true},{"name":"ibm-service-instance-id","in":"header","description":"List buckets that were created in this service instance.","required":true,"schema":{"type":"string"}}],"security":[{"BearerAuth":[]},{"BearerAuth":[],"BasicAuth":[]}],"responses":{"200":{"description":"ok"}},"method":"get","path":"/","servers":[{"url":"/"}],"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"},"BasicAuth":{"type":"http","scheme":"basic"}},"info":{"title":"Cloud Object Storage","version":"1.0.1"},"postman":{"name":"List buckets","description":{"content":"A `GET` request sent to the endpoint root returns a list of buckets that are associated with the specified service instance.\nFor more information about endpoints, see [Endpoints and storage locations](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-endpoints#endpoints).","type":"text/plain"},"url":{"path":[""],"host":["{{baseUrl}}"],"query":[{"disabled":false,"description":{"content":"Provides `LocationConstraint` metadata in the listing.","type":"text/plain"},"key":"extended","value":""}],"variable":[]},"header":[{"disabled":false,"description":{"content":"(Required) List buckets that were created in this service instance.","type":"text/plain"},"key":"ibm-service-instance-id","value":""}],"method":"GET","auth":{"type":"bearer","bearer":[{"type":"any","value":"<Bearer Token>","key":"token"}]}}}
sidebar_class_name: "get api-method"
info_path: cos/cloud-object-storage
---
Expand Down
2 changes: 1 addition & 1 deletion demo/docs/cos/retrieve-a-buckets-headers.api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: retrieve-a-buckets-headers
sidebar_label: Retrieve a bucket's headers
hide_title: true
hide_table_of_contents: true
api: {"tags":["Bucket operations"],"description":"A `HEAD` issued to a bucket will return the headers for that bucket.","parameters":[{"name":"bucketName","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"ok"}},"method":"head","path":"/{bucketName}","servers":[{"url":"https://s3.{region}.cloud-object-storage.appdomain.cloud","variables":{"region":{"enum":["us","eu","ap","us-south","us-east","eu-gb","eu-de","au-syd","jp-tok","ams03","che01","hkg02","mex01","mil01","mon01","osl01","par01","sjc04","sao01","seo01","sng01","tor01"],"default":"us"}}}],"security":[{"BearerAuth":[]}],"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"},"BasicAuth":{"type":"http","scheme":"basic"}},"info":{"title":"Cloud Object Storage","version":"1.0.1"},"postman":{"name":"Retrieve a bucket's headers","description":{"content":"A `HEAD` issued to a bucket will return the headers for that bucket.","type":"text/plain"},"url":{"path":[":bucketName"],"host":["{{baseUrl}}"],"query":[],"variable":[{"disabled":false,"description":{"content":"(Required) ","type":"text/plain"},"type":"any","value":"","key":"bucketName"}]},"method":"HEAD"}}
api: {"tags":["Bucket operations"],"description":"A `HEAD` issued to a bucket will return the headers for that bucket.","parameters":[{"name":"bucketName","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"ok"}},"method":"head","path":"/{bucketName}","servers":[{"url":"/"}],"security":[{"BearerAuth":[]}],"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"},"BasicAuth":{"type":"http","scheme":"basic"}},"info":{"title":"Cloud Object Storage","version":"1.0.1"},"postman":{"name":"Retrieve a bucket's headers","description":{"content":"A `HEAD` issued to a bucket will return the headers for that bucket.","type":"text/plain"},"url":{"path":[":bucketName"],"host":["{{baseUrl}}"],"query":[],"variable":[{"disabled":false,"description":{"content":"(Required) ","type":"text/plain"},"type":"any","value":"","key":"bucketName"}]},"method":"HEAD"}}
sidebar_class_name: "head api-method"
info_path: cos/cloud-object-storage
---
Expand Down
2 changes: 1 addition & 1 deletion demo/docs/food/burgers/list-all-burgers.api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: list-all-burgers
sidebar_label: List All Burgers
hide_title: true
hide_table_of_contents: true
api: {"description":"Burgers","responses":{"200":{"description":"OK"}},"method":"get","path":"/flavors","info":{"title":"Burger Example","version":"1.0.0","description":"Sample description."},"postman":{"name":"List All Burgers","description":{"content":"Burgers","type":"text/plain"},"url":{"path":["flavors"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"method":"GET"}}
api: {"description":"Burgers","responses":{"200":{"description":"OK"}},"parameters":[],"method":"get","path":"/flavors","servers":[{"url":"/"}],"info":{"title":"Burger Example","version":"1.0.0","description":"Sample description."},"postman":{"name":"List All Burgers","description":{"content":"Burgers","type":"text/plain"},"url":{"path":["flavors"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"method":"GET"}}
sidebar_class_name: "get api-method"
info_path: food/burgers/burger-example
---
Expand Down
2 changes: 1 addition & 1 deletion demo/docs/food/yogurtstore/list-all-flavors.api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: list-all-flavors
sidebar_label: List All Flavors
hide_title: true
hide_table_of_contents: true
api: {"description":"Froyo's the best!","responses":{"200":{"description":"OK"}},"method":"get","path":"/flavors","info":{"title":"Frozen Yogurt Example","version":"1.0.0","description":"Sample description."},"postman":{"name":"List All Flavors","description":{"content":"Froyo's the best!","type":"text/plain"},"url":{"path":["flavors"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"method":"GET"}}
api: {"description":"Froyo's the best!","responses":{"200":{"description":"OK"}},"parameters":[],"method":"get","path":"/flavors","servers":[{"url":"/"}],"info":{"title":"Frozen Yogurt Example","version":"1.0.0","description":"Sample description."},"postman":{"name":"List All Flavors","description":{"content":"Froyo's the best!","type":"text/plain"},"url":{"path":["flavors"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"method":"GET"}}
sidebar_class_name: "get api-method"
info_path: food/yogurtstore/frozen-yogurt-example
---
Expand Down
Loading

0 comments on commit fde4866

Please sign in to comment.