@grandlinex/swagger-mate
    Preparing search index...

    Class SPathUtil

    Index
    • Generates a content schema object for the given entity. The schema contains a description derived from the entity metadata and a JSON content schema based on the entity's structure.

      Type Parameters

      • T extends CoreEntity

      Parameters

      • entity: T

        The entity instance for which to generate the content schema. The generic type T must extend CoreEntity.

      Returns
          | {
              content: { "application/json": { schema: SSchemaEl } };
              description: string;
          }
          | undefined

      An object containing the content schema, or undefined if no metadata is available for the entity.

    • Generates a Swagger content definition for the provided entity.

      Type Parameters

      • T extends CoreEntity

      Parameters

      • entity: T

        The entity instance to derive the Swagger schema from.

      • Optionallist: boolean

        When true, the schema will be wrapped in an array type, representing a list of entities.

      Returns SwaggerContent | undefined

      The Swagger content object for the entity, or undefined if the entity does not have a schema.

    • Type Parameters

      • T extends CoreEntity

        extends CoreEntity

      Parameters

      • entity: T

        The entity instance for which to build the response configuration.

      • Optionallist: boolean

        Indicates whether the response should represent a list of entities.

      • Optionalcreate: boolean

        Indicates whether the response corresponds to a creation operation (status code 201); otherwise 200.

      Returns SwaggerRPathConfResponse

      The Swagger response configuration object containing the appropriate status code and content.

    • Creates a Swagger request body definition that references a schema.

      Parameters

      • $ref: string | CoreEntity

        Either the string reference to a schema or a CoreEntity instance whose class name will be used to build the reference path.

      • list: boolean

        If true, the referenced schema is wrapped in an array; otherwise the schema is used directly.

      Returns SwaggerRPathReqBody

      The request body object containing the appropriate content and schema configuration.

    • Generates a mapping from entity names to their corresponding schema objects.

      Parameters

      • ...e: CoreEntity[]

        The entities for which schema entries should be generated.

      Returns SKey<SSchemaElObj>

      An object whose keys are entity names and values are the schemas derived from those entities.

    • Generates a JSON schema representation from a CoreEntity instance.

      This method inspects the entity's metadata to construct a schema object describing the entity's shape. The resulting schema contains:

      • type: always "object".
      • description: a string indicating the entity name.
      • required: an array of property names that are defined on the entity.
      • properties: an object mapping each property name to an object that includes the resolved database type and its nullability.

      If no metadata is found for the provided entity, the method returns undefined.

      Type Parameters

      • T extends CoreEntity

      Parameters

      • entity: T

        The entity instance for which to create a schema.

      Returns SSchemaElObj | undefined

      The generated schema object, or undefined if the entity's metadata could not be retrieved.

      Use ESchemaEditor.schemaFromEntity instead.

    • Builds a JSON schema representation for an entity view that includes both the entity data and its related entity map.

      Type Parameters

      • A extends CoreEntity
      • B extends CoreEntity

      Parameters

      • entity: A

        The primary entity used to construct the dat portion of the schema.

      • entityMap: B

        The related entity map used to construct the join_map portion of the schema.

      Returns SSchemaEl

      A SSchemaEl object schema with properties i, dat, and join_map.

    • Builds a JSON schema reference path for the given component name.

      Parameters

      • inp: string

        The name of the schema component.

      Returns string

      The JSON reference path formatted as #/components/schemas/<inp>.