Skip to content

Commit 218d8d7

Browse files
committed
fix #15, add support for @@meta('doc:ignore', true) in includeInternalModels
1 parent 017e93b commit 218d8d7

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ plugin documentation {
155155
| `cleanOutput` | `boolean` | `false` | When `true`, the output directory is removed before generation to ensure a clean build (use with caution) |
156156
| `title` | `string` | `"Schema Documentation"` | Heading on the index page |
157157
| `fieldOrder` | `"declaration"` or `"alphabetical"` | `"declaration"` | How fields are ordered in tables |
158-
| `includeInternalModels` | `boolean` | `false` | Include models marked `@@ignore` in output |
158+
| `includeInternalModels` | `boolean` | `false` | Include models marked `@@ignore` or annotated with `@@meta('doc:ignore', true)` in output |
159159
| `includeRelationships` | `boolean` | `true` | Generate relationship sections and `relationships.md` |
160160
| `includePolicies` | `boolean` | `true` | Generate access policy tables |
161161
| `includeValidation` | `boolean` | `true` | Generate validation rule tables |

src/extractors.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,24 @@ export function isFieldRequired(field: DataField): boolean {
306306
* Returns `true` if the model has the `@@ignore` attribute.
307307
*/
308308
export function isIgnoredModel(model: DataModel): boolean {
309-
return model.attributes.some((a) => a.decl.ref?.name === '@@ignore');
309+
if (model.attributes.some((a) => a.decl.ref?.name === '@@ignore')) {
310+
return true;
311+
}
312+
313+
// Support @@meta('doc:ignore', true)
314+
for (const attribute of model.attributes) {
315+
if (attribute.decl.ref?.name !== '@@meta') {
316+
continue;
317+
}
318+
319+
const key = stripQuotes(attribute.args[0]?.$cstNode?.text ?? '');
320+
const value = stripQuotes(attribute.args[1]?.$cstNode?.text ?? '');
321+
if (key === 'doc:ignore' && value === 'true') {
322+
return true;
323+
}
324+
}
325+
326+
return false;
310327
}
311328

312329
/**

0 commit comments

Comments
 (0)