-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into amckinney/openapi/v2
- Loading branch information
Showing
27 changed files
with
292 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
## 0.45.3 | ||
**`(fix):`** Unknown schemas are no longer incorrectly marked as `additionalProperties: true`. | ||
|
||
|
4 changes: 2 additions & 2 deletions
4
packages/cli/api-importers/openapi/openapi-ir-parser/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export { type ParseOpenAPIOptions } from "./options"; | ||
export { parse, type Document, type OpenAPIDocument, type SpecImportSettings } from "./parse"; | ||
export { type ParseOpenAPIOptions, getParseOptions } from "./options"; | ||
export { parse, type Document, type OpenAPIDocument } from "./parse"; | ||
export { FernOpenAPIExtension, XFernStreaming, FERN_TYPE_EXTENSIONS } from "./openapi/v3/extensions/fernExtensions"; | ||
export * from "./asyncapi/v2"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
packages/cli/api-importers/openapi/openapi-ir-to-fern/src/ConvertOpenAPIOptions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
export interface ConvertOpenAPIOptions { | ||
/** | ||
* If true, each error will be made unique per endpoint. This is the preferred behavior for Docs. | ||
* If false, error codes will be shared across endpoints. The side effect is that if more than one error schema is detected for each error code, then the error schema will default to unknown. This is the preferred behavior for SDKs. | ||
*/ | ||
enableUniqueErrorsPerEndpoint: boolean; | ||
|
||
/** | ||
* If true, the converter will detect frequently headers and add extract them as global headers within | ||
* the IR. This is primarily used for generating SDKs, but disabled for docs as it allows the documentation | ||
*/ | ||
detectGlobalHeaders: boolean; | ||
|
||
/** | ||
* If true, the converter will generate complex query parameters in the generated Fern Definition. | ||
*/ | ||
objectQueryParameters: boolean; | ||
|
||
/** | ||
* If true, the converter will respect readonly properties in OpenAPI schemas. | ||
*/ | ||
respectReadonlySchemas: boolean; | ||
|
||
/** | ||
* If true, the converter will only include schemas referenced by endpoints. | ||
*/ | ||
onlyIncludeReferencedSchemas: boolean; | ||
|
||
/** | ||
* If true, the converter will include path parameters in the in-lined request. | ||
*/ | ||
inlinePathParameters: boolean; | ||
} | ||
|
||
export const DEFAULT_CONVERT_OPENAPI_OPTIONS: ConvertOpenAPIOptions = { | ||
enableUniqueErrorsPerEndpoint: false, | ||
detectGlobalHeaders: true, | ||
objectQueryParameters: false, | ||
respectReadonlySchemas: false, | ||
onlyIncludeReferencedSchemas: false, | ||
inlinePathParameters: false | ||
}; | ||
|
||
export function getConvertOptions({ | ||
options, | ||
overrides | ||
}: { | ||
options?: ConvertOpenAPIOptions; | ||
overrides?: Partial<ConvertOpenAPIOptions>; | ||
}): ConvertOpenAPIOptions { | ||
return { | ||
enableUniqueErrorsPerEndpoint: | ||
overrides?.enableUniqueErrorsPerEndpoint ?? | ||
options?.enableUniqueErrorsPerEndpoint ?? | ||
DEFAULT_CONVERT_OPENAPI_OPTIONS.enableUniqueErrorsPerEndpoint, | ||
detectGlobalHeaders: | ||
overrides?.detectGlobalHeaders ?? | ||
options?.detectGlobalHeaders ?? | ||
DEFAULT_CONVERT_OPENAPI_OPTIONS.detectGlobalHeaders, | ||
objectQueryParameters: | ||
overrides?.objectQueryParameters ?? | ||
options?.objectQueryParameters ?? | ||
DEFAULT_CONVERT_OPENAPI_OPTIONS.objectQueryParameters, | ||
respectReadonlySchemas: | ||
overrides?.respectReadonlySchemas ?? | ||
options?.respectReadonlySchemas ?? | ||
DEFAULT_CONVERT_OPENAPI_OPTIONS.respectReadonlySchemas, | ||
onlyIncludeReferencedSchemas: | ||
overrides?.onlyIncludeReferencedSchemas ?? | ||
options?.onlyIncludeReferencedSchemas ?? | ||
DEFAULT_CONVERT_OPENAPI_OPTIONS.onlyIncludeReferencedSchemas, | ||
inlinePathParameters: | ||
overrides?.inlinePathParameters ?? | ||
options?.inlinePathParameters ?? | ||
DEFAULT_CONVERT_OPENAPI_OPTIONS.inlinePathParameters | ||
}; | ||
} |
Oops, something went wrong.