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

AllOf not working #12241

Closed
BKillisch opened this issue Sep 22, 2023 · 1 comment · Fixed by swagger-api/swagger-codegen-generators#1247
Closed

AllOf not working #12241

BKillisch opened this issue Sep 22, 2023 · 1 comment · Fixed by swagger-api/swagger-codegen-generators#1247
Assignees

Comments

@BKillisch
Copy link

BKillisch commented Sep 22, 2023

Q&A (please complete the following information)

  • OS: Windows 10
  • Browser: Chrome
  • Version: 106.0.5249.103
  • Method of installation: Online
  • Swagger-Editor version: latest
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

This Problem occurred using the online version of the swagger editor to generate C# model classes from swagger definitions.

The full swagger definition can be found here. The following snippet shows the definition relevant to the bug.

SaleProductOfferResponseV1:
  allOf:
    - type: object
      properties:
        id:
          type: string
        productSet:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/ProductSetElementQuantity'
              - type: object
                properties:
                  product:
                    allOf:
                      - $ref: '#/components/schemas/ProductOfferResponse'
                      - type: object
                        properties:
                          parameters:
                            type: array
                            items:
                              $ref: '#/components/schemas/ParameterProductOfferResponse'
                            description: Product parameters in the offer.
        category:
          $ref: '#/components/schemas/OfferCategory'
        attachments:
          $ref: '#/components/schemas/ProductOfferAttachment'
        fundraisingCampaign:
          $ref: '#/components/schemas/ProductOfferFundraisingCampaignResponse'
        additionalServices:
          $ref: '#/components/schemas/ProductOfferAdditionalServicesResponse'
        delivery:
          $ref: '#/components/schemas/DeliveryProductOfferResponse'
        publication:
          $ref: '#/components/schemas/SaleProductOfferPublicationResponse'
        additionalMarketplaces:
          $ref: '#/components/schemas/AdditionalMarketplacesResponse'
        b2b:
          $ref: '#/components/schemas/B2b'
        compatibilityList:
          $ref: '#/components/schemas/CompatibilityListProductOfferResponse'
        language:
          type: string
          description: Declared base language of the offer.
          format: BCP-47 language code
          example: 'pl-PL'
        validation:
          $ref: '#/components/schemas/Validation'
        afterSalesServices:
          $ref: '#/components/schemas/AfterSalesServices'
        discounts:
          $ref: '#/components/schemas/DiscountsProductOfferResponse'
        stock:
          $ref: '#/components/schemas/Stock'
        parameters:
          type: array
          items:
            $ref: '#/components/schemas/ParameterProductOfferResponse'
          description: List of offer parameters.
        contact:
          allOf:
            - $ref: '#/components/schemas/Contact'
          description: >-
            Identifier of contact data for sales format ADVERTISEMENT (classified ad); retrieve it via GET /sale/offer-contacts.
        createdAt:
          type: string
          format: date-time
          description: >-
            Creation date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. Cannot be modified.
        updatedAt:
          type: string
          format: date-time
          description: >-
            Last update date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. Cannot be modified.
    - $ref: '#/components/schemas/SaleProductOffer'

Swagger-Editor configuration options:
The code was generated by hitting the button in the screenshot. No config options were used.
image

Describe the bug you're encountering

Not all of the properties specified in the 'allOf' of the model 'SaleProductOfferResponseV1' appear in the generated model.
The screenshot below shows the 'ToString' Method of the generated model, which contains all of its properties. It should also have properties for i.e. 'category' and 'additionalServices'.

To reproduce...

Steps to reproduce the behavior:

  1. Go to the latest swagger editor
  2. Paste the content of this link into the editor
  3. Click on 'Generate Client' -> 'csharp-dotnet2'
  4. Find the generate model 'SaleProductOfferResponseV1.cs'
  5. The model does not contain all of the properties specified in the swagger defintion

Expected behavior

All properties specified by 'allOf' appear in the generated model.

Screenshots

image

@char0n
Copy link
Member

char0n commented Oct 5, 2023

Hi @BKillisch,

Thanks for the repost. Transferring this issue to https://github.com/swagger-api/swagger-codegen repository.

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

Successfully merging a pull request may close this issue.

3 participants