openapi: 3.1.0
info:
  title: SearchAPI
  description: A microservice for autocomplete, entity resolution, and dataset discovery.
  version: 0.1.0
paths:
  /search/health:
    get:
      tags:
        - Utility
        - Utility
      summary: Health check endpoint
      operationId: health_check_search_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /search:
    get:
      summary: Search Tickers, Sectors, and Themes
      description: >-
        Performs a search across Tickers, Sectors, and Themes based on the query
        string.


        If 'q' is provided, performs a fuzzy search. If 'q' is omitted, may
        return 

        a list of popular or recently searched items (mocked here).
      operationId: search_entities_search_get
      parameters:
        - name: q
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                minLength: 1
              - type: 'null'
            description: >-
              The search query string (e.g., 'Apple', 'Energy', 'Climate').
              Handles synonyms and aliases.
            title: Q
          description: >-
            The search query string (e.g., 'Apple', 'Energy', 'Climate').
            Handles synonyms and aliases.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SearchResult'
                title: Response Search Entities Search Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /search/{entityId}:
    get:
      summary: Get Entity Metadata
      description: |-
        Retrieves detailed metadata for a specific ticker, sector, or theme, 
        including definitions, methodology, and coverage.
      operationId: get_entity_metadata_search__entityId__get
      security:
        - HTTPBearer: []
      parameters:
        - name: entityId
          in: path
          required: true
          schema:
            type: string
            title: Entityid
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EntityMetadata'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    EntityMetadata:
      properties:
        entityId:
          type: string
          title: Entityid
        name:
          type: string
          title: Name
        definitions:
          additionalProperties:
            type: string
          type: object
          title: Definitions
        methodology:
          type: string
          title: Methodology
        coverage:
          items:
            type: string
          type: array
          title: Coverage
        aliases:
          items:
            type: string
          type: array
          title: Aliases
          default: []
      type: object
      required:
        - entityId
        - name
        - definitions
        - methodology
        - coverage
      title: EntityMetadata
      description: Model for the detailed metadata of an entity.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SearchResult:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        type:
          type: string
          title: Type
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
      type: object
      required:
        - id
        - name
        - type
      title: SearchResult
      description: Model for a single search result item.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
