Running the command results in the following files being generated in the services & models folders:
services/api.service.ts
```typescript
/* tslint:disable */
/* eslint-disable */
import { Injectable } from '@angular/core';
import { HttpClient, HttpResponse, HttpContext } from '@angular/common/http';
import { BaseService } from '../base-service';
import { ApiConfiguration } from '../api-configuration';
import { StrictHttpResponse } from '../strict-http-response';
import { RequestBuilder } from '../request-builder';
import { firstValueFrom } from 'rxjs';
import { map, filter, take } from 'rxjs/operators';
import { SchemaA } from '../models/schema-a';
@Injectable({
providedIn: 'root'
})
export class ApiService extends BaseService {
constructor(
config: ApiConfiguration,
http: HttpClient
) {
super(config, http);
}
/**
* Path part for operation postNew
*/
static readonly PostNewPath = '/dialogInstances';
/**
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `postNew()` instead.
*
* This method sends `application/json` and handles request body of type `application/json`.
*/
postNew$Response(params: {
body: Array
},
context?: HttpContext
): Promise> {
const rb = new RequestBuilder(this.rootUrl, ApiService.PostNewPath, 'post');
if (params) {
rb.body(params.body, 'application/json');
}
return firstValueFrom(
this.http.request(rb.build({
responseType: 'text',
accept: '*/*'
})).pipe(
filter((r: any) => r instanceof HttpResponse),
map((r: HttpResponse) => {
return (r as HttpResponse).clone({ body: undefined }) as StrictHttpResponse;
}),
take(1)
)
);
}
/**
* This method provides access only to the response body.
* To access the full response (for headers, for example), `postNew$Response()` instead.
*
* This method sends `application/json` and handles request body of type `application/json`.
*/
postNew(params: {
body: Array
},
context?: HttpContext
): Promise {
return this.postNew$Response(params).then((r: StrictHttpResponse) => r.body as void
);
}
}
```
models/schema-a.ts
```typescript
/* tslint:disable */
/* eslint-disable */
import { Items } from './items';
export interface SchemaA {
dataList?: Array<{
'displayName'?: string;
}>;
dialog?: {
'dataList'?: Array;
};
}
```
The service looks fine, but the model is broken. It wants to import Items from ./items, but such a model isn't (and probably shouldn't) be generated. The model itself looks rather strange. I expect three models to be generated (schema-a.ts, schema-b.ts & schema-c.ts). Instead, all properties are merged into that one file. If I move everything in one file, three models are generated, as expected.
Are references across files supported? Is this expected behavior? Is there anything wrong with my definition files?
Hi, I have the following TWO yml files:
dummy.yml
```yaml openapi: 3.0.3 info: title: Service description: Provides API version: 0.1.0 servers: - url: /api/v1 description: Sandbox API Endpoint with test data paths: /dialogInstances: post: operationId: postNew requestBody: required: true content: application/json: schema: type: array items: $ref: '#/components/schemas/SchemaA' responses: '200': description: Success components: schemas: SchemaA: properties: dialog: $ref: './dummy2.yml#/components/schemas/SchemaB' dataList: type: array items: $ref: './dummy2.yml#/components/schemas/SchemaC' ```dummy2.yml
```yaml openapi: 3.0.3 info: title: Service description: Provides API version: 0.1.0 servers: - url: /api/v1 paths: /something: get: operationId: getSomething responses: '200': components: schemas: SchemaB: properties: dataList: type: array items: $ref: '#/components/schemas/SchemaC' type: object SchemaC: properties: displayName: type: string ```Running the command results in the following files being generated in the services & models folders:
services/api.service.ts
```typescript /* tslint:disable */ /* eslint-disable */ import { Injectable } from '@angular/core'; import { HttpClient, HttpResponse, HttpContext } from '@angular/common/http'; import { BaseService } from '../base-service'; import { ApiConfiguration } from '../api-configuration'; import { StrictHttpResponse } from '../strict-http-response'; import { RequestBuilder } from '../request-builder'; import { firstValueFrom } from 'rxjs'; import { map, filter, take } from 'rxjs/operators'; import { SchemaA } from '../models/schema-a'; @Injectable({ providedIn: 'root' }) export class ApiService extends BaseService { constructor( config: ApiConfiguration, http: HttpClient ) { super(config, http); } /** * Path part for operation postNew */ static readonly PostNewPath = '/dialogInstances'; /** * This method provides access to the full `HttpResponse`, allowing access to response headers. * To access only the response body, use `postNew()` instead. * * This method sends `application/json` and handles request body of type `application/json`. */ postNew$Response(params: { body: Arraymodels/schema-a.ts
```typescript /* tslint:disable */ /* eslint-disable */ import { Items } from './items'; export interface SchemaA { dataList?: Array<{ 'displayName'?: string; }>; dialog?: { 'dataList'?: ArrayThe service looks fine, but the model is broken. It wants to import
Items
from./items
, but such a model isn't (and probably shouldn't) be generated. The model itself looks rather strange. I expect three models to be generated (schema-a.ts
,schema-b.ts
&schema-c.ts
). Instead, all properties are merged into that one file. If I move everything in one file, three models are generated, as expected.Are references across files supported? Is this expected behavior? Is there anything wrong with my definition files?
Any help is greatly appreciated! Thanks