Ontology as Code API Name Validation Failing

I am getting errors related to my API names that I suspect are due to length:

{
  "type": "typedBlockInstallServiceValidationError",
  "typedBlockInstallServiceValidationError": {
    "blockType": "ONTOLOGY",
    "error": {
      "severity": "BLOCKING",
      "error": {
        "type": "linkTypeInvalidApiName",
        "linkTypeInvalidApiName": {}
      },
      "fallbackMessage": "The specified API Name for the LinkType is invalid. See documentation for ApiName for details. [linkTypeRid=ri.ontology.main.relation.1772999f-f3d3-4759-b943-6836d1a108dc, apiName=investmentGroupOwnershipsinvestmentGroupsToInvestmentGroupOwnershipsByParentInvestmentGroupsPkLinkToMany, linkTypeId=c2udmhwk.investment-groups-to-investment-group-ownerships-by-parent-investment-groups-pk-link-one]"
    },
    "traceId": "8974edca34d93f18"
  }
}

{
  "type": "typedBlockInstallServiceValidationError",
  "typedBlockInstallServiceValidationError": {
    "blockType": "ONTOLOGY",
    "error": {
      "severity": "BLOCKING",
      "error": {
        "type": "linkTypeInvalidApiName",
        "linkTypeInvalidApiName": {}
      },
      "fallbackMessage": "The specified API Name for the LinkType is invalid. See documentation for ApiName for details. [linkTypeRid=ri.ontology.main.relation.90e632ae-5e8f-430c-b158-34d9ed2a9e34, apiName=modelAndValuationAttributesmodelsAndValuationsToModelAndValuationAttributesByModelsAndValuationsPkLinkToMany, linkTypeId=c2udmhwk.models-and-valuations-to-model-and-valuation-attributes-by-models-and-valuations-pk-link-one]"
    },
    "traceId": "8974edca34d93f18"
  }
}

{
  "type": "typedBlockInstallServiceValidationError",
  "typedBlockInstallServiceValidationError": {
    "blockType": "ONTOLOGY",
    "error": {
      "severity": "BLOCKING",
      "error": {
        "type": "linkTypeInvalidApiName",
        "linkTypeInvalidApiName": {}
      },
      "fallbackMessage": "The specified API Name for the LinkType is invalid. See documentation for ApiName for details. [linkTypeRid=ri.ontology.main.relation.0080e95d-d022-40f6-860a-c0887281eb03, apiName=supplierContractPropertyMapsupplierContractToSupplierContractPropertyMapBySupplierContractPkLinkToMany, linkTypeId=c2udmhwk.supplier-contract-to-supplier-contract-property-map-by-supplier-contract-pk-link-one]"
    },
    "traceId": "8974edca34d93f18"
  }
}

{
  "type": "typedBlockInstallServiceValidationError",
  "typedBlockInstallServiceValidationError": {
    "blockType": "ONTOLOGY",
    "error": {
      "severity": "BLOCKING",
      "error": {
        "type": "linkTypeInvalidApiName",
        "linkTypeInvalidApiName": {}
      },
      "fallbackMessage": "The specified API Name for the LinkType is invalid. See documentation for ApiName for details. [linkTypeRid=ri.ontology.main.relation.35d441d9-dcf8-4d10-bd78-fff4cf553c04, apiName=investmentGroupOwnershipsinvestmentGroupsToInvestmentGroupOwnershipsByChildInvestmentGroupsPkLinkToMany, linkTypeId=c2udmhwk.investment-groups-to-investment-group-ownerships-by-child-investment-groups-pk-link-one]"
    },
    "traceId": "8974edca34d93f18"
  }
}

I found the [AIP name validator](https://github.com/palantir/osdk-ts/blob/main/packages/maker/src/util/ApiNameValidator.ts) in the open source repo but these names pass checks:

const RESERVED_KEYWORDS = new Set([
    "ontology",
    "object",
    "property",
    "link",
    "relation",
    "rid",
    "primarykey",
    "typeid",
    "ontologyobject",
]);
const OBJECT_API_NAME_PATTERN = /^([a-zA-Z][a-zA-Z0-9]*)$/;
const API_NAME_PATTERN = /^([a-zA-Z][a-zA-Z0-9_]*)$/;
function isValidApiName(apiName) {
    return API_NAME_PATTERN.test(apiName)
        && !RESERVED_KEYWORDS.has(apiName.toLowerCase());
}
function isValidObjectApiName(apiName) {
    return OBJECT_API_NAME_PATTERN.test(apiName)
        && !RESERVED_KEYWORDS.has(apiName.toLowerCase());
}
console.log(isValidApiName("modelAndValuationAttributesmodelsAndValuationsToModelAndValuationAttributesByModelsAndValuationsPkLinkToMany"));
console.log(isValidObjectApiName("modelAndValuationAttributesmodelsAndValuationsToModelAndValuationAttributesByModelsAndValuationsPkLinkToMany"));

These checks both return true. The error references the provided documentation but I don’t see any docs on how to validate API names in the SDK. Why are these checks failing? Is there docs I should be referring to?

I found these docs here, but according to the provided docs my API names for link types are valid:

In line with functional coding standards, an object type’s API name must:

  • Consist of only alphanumeric characters and underscores.

  • Be unique across all object types.

A property’s API name must:

  • Be valid Unicode.

  • Be unique across all properties belonging to the same object type.

Note that there are a number of reserved keywords that cannot be used for API names. They are: ontology, object, property, link, relation, rid, primaryKey, typeId, and ontologyObject.

https://www.palantir.com/docs/foundry/object-link-types/create-object-type#api-name

You are correct that it’s due to length: 100 characters is the maximum. We’ll get those docs and the validation code updated. Thanks for asking!