Skip to content

Commit

Permalink
Add module readmes to json output (#2500)
Browse files Browse the repository at this point in the history
* Add module readmes to json output

Resolves #2499

* deserialize readme unconditionally
  • Loading branch information
JMBeresford authored Feb 11, 2024
1 parent 33db59c commit de4d813
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib/models/reflections/declaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ export class DeclarationReflection extends ContainerReflection {
this.implementedTypes,
),
implementedBy: serializer.toObjectsOptional(this.implementedBy),
readme: Comment.serializeDisplayParts(serializer, this.readme),
};
}

Expand All @@ -320,14 +321,15 @@ export class DeclarationReflection extends ContainerReflection {
): void {
super.fromObject(de, obj);

if (obj.readme) {
this.readme = Comment.deserializeDisplayParts(de, obj.readme);
}

// This happens when merging multiple projects together.
// If updating this, also check ProjectReflection.fromObject.
if (obj.variant === "project") {
this.kind = ReflectionKind.Module;
this.packageVersion = obj.packageVersion;
if (obj.readme) {
this.readme = Comment.deserializeDisplayParts(de, obj.readme);
}

de.defer(() => {
for (const [id, sid] of Object.entries(obj.symbolIdMap || {})) {
Expand Down
1 change: 1 addition & 0 deletions src/lib/serialization/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ export interface DeclarationReflection
| "getSignature"
| "setSignature"
| "typeParameters"
| "readme"
> {}

/** @category Reflections */
Expand Down

0 comments on commit de4d813

Please sign in to comment.