Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethaasan committed Nov 17, 2023
1 parent f813492 commit 33c831a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
16 changes: 16 additions & 0 deletions docs/migrations/version-2-to-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

This document contains all the breaking changes and migrations guidelines for adapting your code to the new version.

## allowInheritance set to true will enable inheritance

This feature introduces a new option called `allowInheritance` in the interpreter options, which controls whether the generated models should inherit when the schema includes an `allOf`. By default, this option is set to false, which means that you'll not be affected if this property is not set. In the `MetaModel` and the `ConstrainedMetaModel` options, there is now an `extend` property (a list of models) and an `isExtended` property (boolean).

Here is an example of how to use the new feature and the `allowInheritance` option in your code:

```ts
const generator = new JavaFileGenerator({
processorOptions: {
interpreter: {
allowInheritance: true
}
}
});
```

### TypeScript

Is not affected by this change.
Expand Down
5 changes: 4 additions & 1 deletion src/interpreter/Interpreter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export type InterpreterOptions = {
*/
discriminator?: string;
/**
* Use this option to disable cache when interpreting schemas. This will affect merging of schemas.
* This options disables the seenSchemas cache in the Interpreter.
* Use this option to disable the seenSchemas cache when interpreting schemas.
* This will affect merging of schemas, and should only be used by the internal interpreters when allowInheritance is set to true.
* This allows the internal interpreters to keep clean copies of the schemas as CommonModel's.
*/
disableCache?: boolean;
};
Expand Down

0 comments on commit 33c831a

Please sign in to comment.