Updates 2 of many

This commit is contained in:
rijkvanzanten
2023-03-22 16:23:25 -04:00
parent 05034d0e17
commit 0a137551a8
3 changed files with 25 additions and 23 deletions

View File

@@ -113,11 +113,12 @@ class OASSpecsService implements SpecificationSubService {
description: 'Your current Directus instance.',
},
],
tags,
paths,
components,
};
if (tags) spec.tags = tags;
if (components) spec.components = components;
return spec;
}
@@ -145,11 +146,16 @@ class OASSpecsService implements SpecificationSubService {
}
}
} else {
tags.push({
const tag: TagObject = {
name: 'Items' + formatTitle(collection.collection).replace(/ /g, ''),
description: collection.meta?.note || undefined,
'x-collection': collection.collection,
});
};
if (collection.meta?.note) {
tag.description = collection.meta.note;
}
tags.push(tag);
}
}
@@ -404,10 +410,15 @@ class OASSpecsService implements SpecificationSubService {
}
private generateField(field: Field, relations: Relation[], tags: TagObject[], fields: Field[]): SchemaObject {
let propertyObject: SchemaObject = {
nullable: field.schema?.is_nullable,
description: field.meta?.note || undefined,
};
let propertyObject: SchemaObject = {};
if (field.schema && 'is_nullable' in field.schema) {
propertyObject.nullable = field.schema.is_nullable;
}
if (field.meta?.note) {
propertyObject.description = field.meta.note;
}
const relation = relations.find(
(relation) =>
@@ -482,14 +493,7 @@ class OASSpecsService implements SpecificationSubService {
return propertyObject;
}
private fieldTypes: Record<
Type,
{
type?: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'integer' | 'null' | undefined;
format?: string;
items?: any;
}
> = {
private fieldTypes: Record<Type, Partial<SchemaObject>> = {
alias: {
type: 'string',
},
@@ -546,9 +550,7 @@ class OASSpecsService implements SpecificationSubService {
type: 'string',
format: 'timestamp',
},
unknown: {
type: undefined,
},
unknown: {},
uuid: {
type: 'string',
format: 'uuid',

View File

@@ -15,7 +15,7 @@ export type ColPathProps = {
export type ColPathResult = {
columnPath: string;
targetCollection: string;
addNestedPkField?: string;
addNestedPkField: string | undefined;
};
/**

View File

@@ -7,8 +7,8 @@ import { InvalidQueryException } from '../exceptions';
import { applyFunctionToColumnName } from './apply-function-to-column-name';
type GetColumnOptions = {
query?: Query;
originalCollectionName?: string;
query?: Query | undefined;
originalCollectionName?: string | undefined;
};
/**