Merge branch 'master' of https://github.com/YMFE/yapi into hotfix

# Conflicts:
#	package.json
This commit is contained in:
ariesly15 2021-08-30 11:31:49 +08:00
commit bc8f6ee0e7
11 changed files with 21 additions and 16 deletions

View File

@ -122,6 +122,7 @@ YApi 是<strong>高效</strong>、<strong>易用</strong>、<strong>功能强大
* [zwjamnsss](https://github.com/amnsss)
* [dwb1994](https://github.com/dwb1994)
* [fungezi](https://github.com/fungezi)
* [ariesly15](https://github.com/ariesly15)
### License

View File

@ -99,7 +99,7 @@ Footer.defaultProps = {
]
},
{
title: 'Copyright © 2018 YMFE',
title: `Copyright © 2018-${new Date().getFullYear()} YMFE`,
linkList: [
{
itemTitle: `版本: ${version} `,

View File

@ -12,7 +12,8 @@ export default class Notify extends Component {
}
componentDidMount() {
axios.get('https://www.easy-mock.com/mock/5c2851e3d84c733cb500c3b9/yapi/versions').then(req => {
const versions = 'https://www.fastmock.site/mock/1529fa78fa4c4880ad153d115084a940/yapi/versions';
axios.get(versions).then(req => {
if (req.status === 200) {
this.setState({ newVersion: req.data.data[0] });
} else {

View File

@ -385,7 +385,7 @@ class View extends Component {
接口名称
</Col>
<Col span={8} className="colName">
{title}
<span title={title}>{title}</span>
</Col>
<Col span={4} className="colKey">
&ensp;&ensp;

View File

@ -139,7 +139,7 @@ export default class Project extends Component {
});
}
if (Object.keys(this.props.curProject).length === 0) {
if (this.props.curProject == null || Object.keys(this.props.curProject).length === 0) {
return <Loading visible />;
}

View File

@ -32,7 +32,7 @@
width: 100%;
.label{
padding-right: 8px;
width: 115px;
width: 150px;
display: inline-block;
}
.label:after {

View File

@ -332,6 +332,6 @@ export async function checkProjectName(name, group_id) {
export async function handleSwaggerUrlData(url) {
return {
type: GET_SWAGGER_URL_DATA,
payload: axios.get('/api/project/swagger_url?url='+url)
payload: axios.get('/api/project/swagger_url?url='+encodeURI(encodeURI(url)))
};
}

View File

@ -47,6 +47,10 @@ const mapping = function(data, index) {
}
};
const ConcatDesc = (title, desc) => {
return [title, desc].join('\n').trim();
};
const Schema = (data, key) => {
let result = mapping(data, key);
if (data.type !== 'object') {
@ -88,7 +92,7 @@ const SchemaObject = (data, key) => {
let item = {
name,
key: key + '-' + index,
desc: copiedState.description,
desc: ConcatDesc(copiedState.title, copiedState.description),
required: required.indexOf(name) != -1
};
@ -107,7 +111,7 @@ const SchemaObject = (data, key) => {
const SchemaString = data => {
let item = {
desc: data.description,
desc: ConcatDesc(data.title, data.description),
default: data.default,
maxLength: data.maxLength,
minLength: data.minLength,
@ -131,7 +135,7 @@ const SchemaArray = (data, index) => {
}
let item = {
desc: data.description,
desc: ConcatDesc(data.title, data.description),
default: data.default,
minItems: data.minItems,
uniqueItems: data.uniqueItems,
@ -147,7 +151,7 @@ const SchemaArray = (data, index) => {
const SchemaNumber = data => {
let item = {
desc: data.description,
desc: ConcatDesc(data.title, data.description),
maximum: data.maximum,
minimum: data.minimum,
default: data.default,
@ -161,7 +165,7 @@ const SchemaNumber = data => {
const SchemaInt = data => {
let item = {
desc: data.description,
desc: ConcatDesc(data.title, data.description),
maximum: data.maximum,
minimum: data.minimum,
default: data.default,
@ -175,7 +179,7 @@ const SchemaInt = data => {
const SchemaBoolean = data => {
let item = {
desc: data.description,
desc: ConcatDesc(data.title, data.description),
default: data.default,
enum: data.enum,
mock: data.mock && data.mock.mock
@ -185,7 +189,7 @@ const SchemaBoolean = data => {
const SchemaOther = data => {
let item = {
desc: data.description,
desc: ConcatDesc(data.title, data.description),
default: data.default,
mock: data.mock && data.mock.mock
};

View File

@ -44,7 +44,7 @@
"generate-schema": "^2.6.0",
"immer": "^1.1.1",
"js-base64": "^2.3.2",
"json-schema-faker": "^0.5.0-rc16",
"json-schema-faker": "0.5.0-rc16",
"json-schema-ref-parser": "4.0.0",
"json5": "0.5.1",
"jsondiffpatch": "0.3.11",

View File

@ -27,7 +27,7 @@ app.proxy = true;
yapi.app = app;
// app.use(bodyParser({multipart: true}));
app.use(koaBody({ multipart: true, jsonLimit: '2mb', formLimit: '1mb', textLimit: '1mb' }));
app.use(koaBody({strict: false, multipart: true, jsonLimit: '2mb', formLimit: '1mb', textLimit: '1mb' }));
app.use(mockServer);
app.use(router.routes());
app.use(router.allowedMethods());

View File

@ -593,7 +593,6 @@ ${JSON.stringify(schema, null, 2)}`)
} catch (err) {
logs.push(convertString(err));
result.logs = logs;
logs.push(err.name + ': ' + err.message)
return yapi.commons.resReturn(result, 400, err.name + ': ' + err.message);
}
};