mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 07:03:38 +00:00
ID in schema have type string
This commit is contained in:
commit
6b94965574
@ -147,7 +147,7 @@
|
||||
"deprecated": false,
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@ -46,7 +46,7 @@ const getPathParams = (routePath) => {
|
||||
description: '',
|
||||
deprecated: false,
|
||||
required: true,
|
||||
schema: { type: 'string' },
|
||||
schema: { type: 'number' },
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
@ -102,8 +102,8 @@ const getAllSchemasForContentType = ({ routeInfo, attributes, uniqueName }) => {
|
||||
[`${pascalCase(uniqueName)}LocalizationResponse`]: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string' },
|
||||
...cleanSchemaAttributes(attributes, { addComponentSchema }),
|
||||
id: { type: 'number' },
|
||||
...cleanSchemaAttributes(attributes),
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -145,6 +145,11 @@ const getAllSchemasForContentType = ({ routeInfo, attributes, uniqueName }) => {
|
||||
data: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'number' },
|
||||
attributes: { type: 'object', properties: cleanSchemaAttributes(attributes) },
|
||||
},
|
||||
$ref: `#/components/schemas/${pascalCase(uniqueName)}ListResponseDataItem`,
|
||||
},
|
||||
},
|
||||
@ -175,6 +180,10 @@ const getAllSchemasForContentType = ({ routeInfo, attributes, uniqueName }) => {
|
||||
id: { type: 'string' },
|
||||
attributes: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'number' },
|
||||
attributes: { type: 'object', properties: cleanSchemaAttributes(attributes) },
|
||||
},
|
||||
properties: cleanSchemaAttributes(attributes, {
|
||||
addComponentSchema,
|
||||
componentSchemaRefName: `#/components/schemas/${pascalCase(
|
||||
|
||||
@ -115,6 +115,25 @@ const cleanSchemaAttributes = (
|
||||
if (attribute.repeatable) {
|
||||
attributesCopy[prop] = {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
...(isRequest ? {} : { id: { type: 'number' } }),
|
||||
...cleanSchemaAttributes(componentAttributes, { typeMap, isRequest }),
|
||||
},
|
||||
},
|
||||
};
|
||||
} else {
|
||||
attributesCopy[prop] = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
...(isRequest ? {} : { id: { type: 'number' } }),
|
||||
...cleanSchemaAttributes(componentAttributes, {
|
||||
typeMap,
|
||||
isRequest,
|
||||
}),
|
||||
},
|
||||
};
|
||||
items: finalComponentSchema,
|
||||
};
|
||||
} else {
|
||||
@ -128,7 +147,7 @@ const cleanSchemaAttributes = (
|
||||
const rawComponentSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
...(isRequest ? {} : { id: { type: 'string' } }),
|
||||
...(isRequest ? {} : { id: { type: 'number' } }),
|
||||
__component: { type: 'string' },
|
||||
...cleanSchemaAttributes(componentAttributes, {
|
||||
typeMap,
|
||||
|
||||
@ -15,7 +15,7 @@ module.exports = (isListOfEntities, attributes) => {
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string' },
|
||||
id: { type: 'number' },
|
||||
attributes: { type: 'object', properties: attributes },
|
||||
},
|
||||
},
|
||||
@ -25,7 +25,7 @@ module.exports = (isListOfEntities, attributes) => {
|
||||
return {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string' },
|
||||
id: { type: 'number' },
|
||||
attributes: { type: 'object', properties: attributes },
|
||||
},
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user