Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Generator fails on simple input #8

Open
Pzixel opened this issue May 7, 2020 · 0 comments
Open

Generator fails on simple input #8

Pzixel opened this issue May 7, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@Pzixel
Copy link

Pzixel commented May 7, 2020

Openapi.yaml

x-generator: NSwag v13.3.0.0 (NJsonSchema v10.1.11.0 (Newtonsoft.Json v12.0.0.0))
openapi: 3.0.0
info:
  title: Settings API
  description: Settings and presets service
  version: v1
servers:
  - url: 'https://myUrl'
paths:
  /:
    get:
      tags:
        - About
      operationId: About_Get
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageModel'
  /settings/api:
    get:
      tags:
        - About
      operationId: About_Get2
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageModel'
  /Healthcheck:
    get:
      tags:
        - Healthcheck
      operationId: Healthcheck_Get
      responses:
        '200':
          description: ''
  /settings/api/Healthcheck:
    get:
      tags:
        - Healthcheck
      operationId: Healthcheck_Get2
      responses:
        '200':
          description: ''
components:
  schemas:
    MessageModel:
      type: object
      additionalProperties: false
      properties:
        message:
          type: string
          nullable: true
    Integration:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: guid
        createdBy:
          type: string
          format: guid
        createdOn:
          type: string
          format: date-time
        modifiedBy:
          type: string
          format: guid
          nullable: true
        modifiedOn:
          type: string
          format: date-time
          nullable: true
        deletedReason:
          type: string
          nullable: true
        deletedBy:
          type: string
          format: guid
          nullable: true
        deletedOn:
          type: string
          format: date-time
          nullable: true
        companyId:
          type: string
          format: guid
        title:
          type: string
          nullable: true
  securitySchemes:
    Bearer:
      type: apiKey
      description: Please insert Auth token into field
      name: Authorization
      in: header
security:
  - Bearer: []

Command:

cargo-swagg ./openapi.yaml --out-file ./src/api.rs

Expected result:

Got API

Actual result:

#![allow(dead_code, unused_imports)]
pub mod api {
    #[doc = "Settings and presets service"]
    pub struct SettingsApi {
        api: actix_swagger::Api,
    }
    impl SettingsApi {
        pub fn new() -> Self {
            Self {
                api: actix_swagger::Api::new(),
            }
        }
    }
    impl Default for SettingsApi {
        fn default() -> Self {
            let api = Self::new();
            api
        }
    }
    impl actix_web::dev::HttpServiceFactory for SettingsApi {
        fn register(self, config: &mut actix_web::dev::AppService) {
            self.api.register(config);
        }
    }
    use super::paths;
    use actix_swagger::{Answer, Method};
    use actix_web::{dev::Factory, FromRequest};
    use std::future::Future;
    impl SettingsApi {}
}
pub mod components {
    pub mod parameters {
        use serde::{Deserialize, Serialize};
    }
    pub mod request_bodies {
        use serde::{Deserialize, Serialize};
    }
    pub mod responses {
        use serde::{Deserialize, Serialize};
    }
}
pub mod paths {
    use super::components::{parameters, responses};
}
@sergeysova sergeysova added the bug Something isn't working label May 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants