Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[typescript-axios] attribute components.schemas.XXXX is missing but it isn't #6145

Closed
paulfrench opened this issue May 3, 2020 · 5 comments

Comments

@paulfrench
Copy link

I download API as JSON resolved (https://app.swaggerhub.com/apis/AdvancedComputerSoft/e-commerce/1.0.25)

Using generator version 4.3.0 installed via npm I run....

openapi-generator generate -i openapi.json -g typescript-axios -o clientSDK

I get...

There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
 | Error count: 13, Warning count: 0
Errors:
        -attribute components.schemas.allDeliveryAddresses.items is missing
        -attribute components.schemas.allVatRates.items is missing
        -attribute components.schemas.allProducts.items is missing
        -attribute components.schemas.allCustomers.items is missing
        -attribute components.schemas.allStockCategories.items is missing
        -attribute components.schemas.allBankAccounts.items is missing
        -attribute components.schemas.allCompanies.items is missing
        -attribute components.schemas.allLocations.items is missing
        -attribute components.schemas.allExchangeRates.items is missing
        -attribute components.schemas.allVatTypes.items is missing
        -attribute components.schemas.allReceipts.items is missing
        -attribute components.schemas.allSalesInvoices.items is missing
        -attribute components.schemas.allSalesOrders.items is missing

However the open API is marked as valid on swaggerhub and imports fine into POSTMAN. I'm a newbie so apologies if this is stupid question but why can't I generate an SDK for this valid spec.

If I inspect the file visually I can see local $ref that should resolve fine to the above named attributes.

Many Thanks

@auto-labeler
Copy link

auto-labeler bot commented May 3, 2020

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@paulfrench paulfrench changed the title -attribute components.schemas.XXXX is missing but it isn't [typescript-axios] attribute components.schemas.XXXX is missing but it isn't Jun 4, 2020
@paulfrench
Copy link
Author

mistake in my open api spec

@PSchubertMHP
Copy link

PSchubertMHP commented Jul 20, 2021

Hi @paulfrench, what was your solution? I've experiencing the same issue and I can't wrap my head around it. Thanks in advance!

@paulfrench
Copy link
Author

I simply had mistakes in my spec e.g. I had...

    allReceipts:
      type: array
      properties:
        items:
          $ref: '#/components/schemas/receipt'

...and it should have been...

    allReceipts:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/receipt'

What confused me at the time was I had a property named "items" in my json yet "items" is also used by the OAS spec when specifying an array.

You may have similar issue. Hope it helps.

@PSchubertMHP
Copy link

Hi, thanks for your resolution. I had a similar problem. One of the schema properties value had a list of permitted types. Amongst others an array type which had no items definition.

"properties": {
  "value": {
    "oneOf": [
      {
        "type": "string"
      },
      {
        "type": "number"
      },
      {
        "type": "boolean"
      },
      {
        "type": "array"
      },
      {
        "type": "object"
      }
    ]
  }
}

I removed the type definition altogether.

"properties": {
  "value": {}
}

Which resolved my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants