TradeStation · API Governance Rules

TradeStation API Rules

Spectral linting rules defining API design standards and conventions for TradeStation.

11 Rules error 6 warn 5
View Rules File View on GitHub

Rule Categories

tradestation

Rules

warn
tradestation-operation-summary-title-case
Operation summaries must use Title Case.
$.paths[*][*].summary
error
tradestation-operation-ids-required
All operations must have an operationId.
$.paths[*][*]
warn
tradestation-operation-description-required
All operations must have a description.
$.paths[*][*]
error
tradestation-oauth2-required
API must use OAuth2 authorization code authentication.
$.components.securitySchemes.oauth2AuthCode
error
tradestation-versioned-paths
All API paths must use the /v3/ version prefix.
$.paths[*]~
warn
tradestation-tags-required
All operations must be tagged.
$.paths[*][*]
warn
tradestation-pascal-case-schema-properties
Schema property names must use PascalCase to match TradeStation API conventions.
$.components.schemas[*].properties[*]~
error
tradestation-response-200-defined
All operations must define a 200 success response.
$.paths[*][*].responses
warn
tradestation-response-401-defined
All operations must define a 401 unauthorized response.
$.paths[*][*].responses
error
tradestation-post-request-body
POST operations must define a requestBody.
$.paths[*][post]
error
tradestation-order-required-fields
OrderRequest must define AccountID, Symbol, Quantity, OrderType, TradeAction, TimeInForce as required.
$.components.schemas.OrderRequest.required

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  tradestation-operation-summary-title-case:
    description: Operation summaries must use Title Case.
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9]*(\\s[A-Z][a-zA-Z0-9]*)*$"

  tradestation-operation-ids-required:
    description: All operations must have an operationId.
    severity: error
    given: "$.paths[*][*]"
    then:
      field: operationId
      function: defined

  tradestation-operation-description-required:
    description: All operations must have a description.
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: description
      function: defined

  tradestation-oauth2-required:
    description: API must use OAuth2 authorization code authentication.
    severity: error
    given: "$.components.securitySchemes.oauth2AuthCode"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          properties:
            type:
              const: oauth2

  tradestation-versioned-paths:
    description: All API paths must use the /v3/ version prefix.
    severity: error
    given: "$.paths[*]~"
    then:
      function: pattern
      functionOptions:
        match: "^/v3/"

  tradestation-tags-required:
    description: All operations must be tagged.
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: tags
      function: defined

  tradestation-pascal-case-schema-properties:
    description: Schema property names must use PascalCase to match TradeStation API conventions.
    severity: warn
    given: "$.components.schemas[*].properties[*]~"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9]*$"

  tradestation-response-200-defined:
    description: All operations must define a 200 success response.
    severity: error
    given: "$.paths[*][*].responses"
    then:
      field: "200"
      function: defined

  tradestation-response-401-defined:
    description: All operations must define a 401 unauthorized response.
    severity: warn
    given: "$.paths[*][*].responses"
    then:
      field: "401"
      function: defined

  tradestation-post-request-body:
    description: POST operations must define a requestBody.
    severity: error
    given: "$.paths[*][post]"
    then:
      field: requestBody
      function: defined

  tradestation-order-required-fields:
    description: OrderRequest must define AccountID, Symbol, Quantity, OrderType, TradeAction, TimeInForce as required.
    severity: error
    given: "$.components.schemas.OrderRequest.required"
    then:
      function: schema
      functionOptions:
        schema:
          type: array
          contains:
            const: AccountID