简体   繁体   English

SwaggerHub 模拟总是返回相同的 id - 这是预期的吗?

[英]SwaggerHub mock always returns the same id - is this expected?

I created a very simple OpenAPI docs as I have just started learning about it.我创建了一个非常简单的 OpenAPI 文档,因为我刚刚开始学习它。

This is the link: https://app.swaggerhub.com/apis-docs/srki.coric/Shopping_Cart/1.0.0这是链接: https://app.swaggerhub.com/apis-docs/srki.coric/Shopping_Cart/1.0.0

There is a mock server however, my expectation was that if I do a POST request with certain data, that the response will contain that data, and that _id would be auto-generated, but the response is always the default one.但是有一个模拟服务器,我的期望是,如果我使用某些数据执行 POST 请求,响应将包含该数据,并且_id将自动生成,但响应始终是默认值。

Is this the expected behavior or I am doing something wrong?这是预期的行为还是我做错了什么?

This is expected behavior.这是预期的行为。 SwaggerHub mocks are static, not dynamic. SwaggerHub 模拟是 static,不是动态的。 The mock does not process input data in any way, it just returns a static response based on the response schema .模拟不会以任何方式处理输入数据,它只是根据响应schema返回 static 响应。 See How response mocking works in SwaggerHub documentation.请参阅 SwaggerHub 文档中的响应 mocking 如何工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM