@redocly/openapi-core
Advanced tools
Comparing version 1.0.0-beta.73 to 1.0.0-beta.74
@@ -25,2 +25,5 @@ "use strict"; | ||
} | ||
if (REDOCLY_DOMAIN === 'redoc.online') { | ||
exports.DOMAINS[REDOCLY_DOMAIN] = REDOCLY_DOMAIN; | ||
} | ||
class LintConfig { | ||
@@ -27,0 +30,0 @@ constructor(rawConfig, configFile) { |
@@ -175,5 +175,3 @@ "use strict"; | ||
deprecated: { type: 'boolean' }, | ||
const: { | ||
enum: ['object', 'array', 'string', 'number', 'integer', 'boolean', 'null'], | ||
}, | ||
const: null, | ||
$comment: { type: 'string' }, | ||
@@ -180,0 +178,0 @@ }, |
{ | ||
"name": "@redocly/openapi-core", | ||
"version": "1.0.0-beta.73", | ||
"version": "1.0.0-beta.74", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
import { outdent } from 'outdent'; | ||
import { lintFromString, lintConfig } from '../lint'; | ||
import { lintFromString, lintConfig, lintDocument } from '../lint'; | ||
import { BaseResolver } from '../resolve'; | ||
import { loadConfig } from '../config/load'; | ||
import { parseYamlToDocument, replaceSourceWithRef } from '../../__tests__/utils'; | ||
// todo create general utils for tests and move this config. | ||
import { makeConfig } from '../rules/__tests__/config'; | ||
@@ -106,2 +109,43 @@ describe('lint', () => { | ||
}); | ||
it("'const' can have any type", async () => { | ||
const document = parseYamlToDocument( | ||
outdent` | ||
openapi: "3.1.0" | ||
info: | ||
version: 1.0.0 | ||
title: Swagger Petstore | ||
description: Information about Petstore | ||
license: | ||
name: MIT | ||
url: https://opensource.org/licenses/MIT | ||
servers: | ||
- url: http://petstore.swagger.io/v1 | ||
paths: | ||
/pets: | ||
get: | ||
summary: List all pets | ||
operationId: listPets | ||
tags: | ||
- pets | ||
responses: | ||
200: | ||
description: An paged array of pets | ||
content: | ||
application/json: | ||
schema: | ||
type: string | ||
const: ABC | ||
`, | ||
'foobar.yaml', | ||
); | ||
const results = await lintDocument({ | ||
externalRefResolver: new BaseResolver(), | ||
document, | ||
config: makeConfig({ spec: 'error', }), | ||
}); | ||
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`); | ||
}); | ||
}); |
@@ -139,2 +139,5 @@ import * as fs from 'fs'; | ||
} | ||
if (REDOCLY_DOMAIN === 'redoc.online') { | ||
DOMAINS[REDOCLY_DOMAIN as Region] = REDOCLY_DOMAIN; | ||
} | ||
@@ -141,0 +144,0 @@ export type RawConfig = { |
@@ -178,5 +178,3 @@ import { NodeType, listOf, mapOf } from '.'; | ||
deprecated: { type: 'boolean' }, | ||
const: { | ||
enum: ['object', 'array', 'string', 'number', 'integer', 'boolean', 'null'], | ||
}, | ||
const: null, | ||
$comment: { type: 'string' }, | ||
@@ -183,0 +181,0 @@ }, |
Sorry, the diff of this file is not supported yet
1945512
24529