Skip to content
This repository was archived by the owner on Aug 9, 2021. It is now read-only.
This repository was archived by the owner on Aug 9, 2021. It is now read-only.

Files which export only enums not properly handled #50

@bastijnv

Description

@bastijnv

type2docfx does not properly handle files that only export enums. A file is generated with as child the the enum but no references. DocFX build fails on these files.

To reproduce you can extract the AuthenticationType from authentication_provide.ts in a separate file and change authentication_provide.ts to the following:

// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

import { TransportConfig } from './authorization';
import { Callback } from './promise_utils';
import { AuthenticationType } from './authentication_type'

/**
 * Interface that must be implemented by objects that are used to provide credentials to the transports used by the device client
 * to authenticate with an Azure IoT hub instance.
 */
export interface AuthenticationProvider {
  type: AuthenticationType;
  getDeviceCredentials(callback: Callback<TransportConfig>): void;
  getDeviceCredentials(): Promise<TransportConfig>;
  setTokenRenewalValues?(tokenValidTimeInSeconds: number, tokenRenewalMarginInSeconds: number): void;
  }

Now run:

  1. typedoc --json api.json azure-iot-sdk-node/common/core/src --module commonjs --includeDeclarations --ignoreCompilerErrors --excludeExternals
  2. type2docfx api.json yml

This generates a yml file named authentication_type.yml which contains the following:

### YamlMime:UniversalReference
items:
  - uid: azure-iot-common.authentication_type
    name: authentication_type
    langs:
      - typeScript
    fullName: authentication_type
    children:
      - azure-iot-common.authentication_type.AuthenticationType
    type: module
    summary: ''
    package: azure-iot-common
references: []

If you use that as the YML input to DocFX (docfx docfx.json --serve) you will get the following error during build:

[20-03-31 07:37:29.731]Error:[BuildCommand.BuildCore.Build Document.LinkPhaseHandlerWithIncremental.UniversalReferenceDocumentProcessor.Save](yml/authentication_type.yml)Can't find azure-iot-common.authentication_type.AuthenticationType in items or references
[20-03-31 07:37:36.069]Info:[BuildCommand]Completed building documents in 11749.1673 milliseconds.
[20-03-31 07:37:36.073]Info:[BuildCommand]Completed Scope:BuildCommand in 12034.604 milliseconds.
[20-03-31 07:37:36.074]Error:Can't find azure-iot-common.authentication_type.AuthenticationType in items or references

I think the solution is to simply not generate the file authentication_type.yml as it is not required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions