swagger-api / swagger-api/swagger-codegen

use swagger codegen to generate goalng code by amazon sp api json model

Open
#12,141 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

/*

  • Selling Partner API for Catalog Items
  • The Selling Partner API for Catalog Items provides programmatic access to information about items in the Amazon catalog. For more information, refer to the Catalog Items API Use Case Guide.
  • API version: 2022-04-01
  • Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
    */
    package swagger

// An item in the Amazon catalog.
type Item struct {
Asin string json:"asin"
Attributes *ModelMap json:"attributes,omitempty"
Dimensions *[]ItemDimensionsByMarketplace json:"dimensions,omitempty"
Identifiers *[]ItemIdentifiersByMarketplace json:"identifiers,omitempty"
Images *[]ItemImagesByMarketplace json:"images,omitempty"
ProductTypes *[]ItemProductTypeByMarketplace json:"productTypes,omitempty"
Relationships *[]ItemRelationshipsByMarketplace json:"relationships,omitempty"
SalesRanks *[]ItemSalesRanksByMarketplace json:"salesRanks,omitempty"
Summaries *[]ItemSummaryByMarketplace json:"summaries,omitempty"
VendorDetails *[]ItemVendorDetailsByMarketplace json:"vendorDetails,omitempty"
}

Golang Error: undeclared name: ModelMap

Swagger-codegen version

3.0.42

Swagger declaration file content or url

https://raw.githubusercontent.com/skeleton1231/selling-partner-api-models/main/models/catalog-items-api-model/catalogItems_2022-04-01.json

Command line used for generation

swagger-codegen generate -i catalog-items-api-model/catalogItems_2022-04-01.json -l go -o /Users/huanghaitao/go/src/amz-sp-api-gosdk/catalog-items-api-model

Should I use interface ?

package swagger

type ModelMap map[string]interface{}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the generation using the linked catalogItems_2022-04-01.json declaration and the reported swagger-codegen command. Inspect the generated Item model and the Go templates or model definitions responsible for ModelMap; done means the generated package defines or references that type consistently and builds without the undeclared-name error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.