Swagger UI目前是否支持模型?(Does Swagger UI currently support models?)
Swagger Spec提供了描述模型的规定。
但是,现有的Swagger-UI项目似乎没有使用它或显示模型。 看看Petstore演示 ,我看到一个模型被提供 ,但看不到它显示。
我错过了什么吗? 还是只是不支持?
The Swagger Spec has provision for describing a model.
However, the existing Swagger-UI project doesn't seem to consume it or display the model. Looking at the Petstore Demo, I see that a model is served, but can't see it displayed.
Am I missing something? Or is it just not supported yet?
原文:https://stackoverflow.com/questions/11102058
最满意答案
它不必是完全相同的对象,它只需要看起来与外部观察者相同。 如果将所有数据从一个对象复制到另一个对象,它将完成相同的任务。
public SmartForm(string loadCode) { _loadCode = loadCode; SmartForms smartForms = new SmartForms(_loadCode); this.IdCode = smartForms[0].IdCode; this.Title = smartForms[0].Title; }
It doesn't have to be exactly the same object, it just has to appear to be the same to external observers. If you copy all the data from one object to another, it will accomplish the same thing.
public SmartForm(string loadCode) { _loadCode = loadCode; SmartForms smartForms = new SmartForms(_loadCode); this.IdCode = smartForms[0].IdCode; this.Title = smartForms[0].Title; }
相关问答
更多-
TCP/IP模型是一个________。[2023-05-19]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
C#:在构造函数中使用它(C# : Using this in a constructor)[2023-07-21]
是的,您可以在构造函数中使用this ,但不能在字段初始值设定项中使用它。 所以这是无效的: class Foo { private int _bar = this.GetBar(); int GetBar() { return 42; } } 但这是允许的: class Foo { private int _bar; public Foo() { _bar = this.GetBar(); } ... -
C ++和STL:构造器工厂(C++ and STL: Constructor Factory)[2022-01-10]
没有必要使用他们花哨的新奇地图。 templateBaseImplementation* makeAlgo (const std::string& algo, const byte* seed, size_t size) { return new Impl(algo, seed, size); } typedef BaseImplementation* makeAlgo_t (const std::str ... -
C ++静态工厂构造函数(C++ static factory constructor)[2021-06-11]
您的代码当前包含内存泄漏:必须使用delete清除使用new创建的任何对象。 createWithID方法最好不要使用new ,看起来像这样: static Object createWithID(int id) { Object obj; obj.id = id; return obj; } 这似乎需要对象的附加副本,但实际上, 返回值优化通常会使该副本被优化掉。 Your code currently contains a memory leak: any object c ... -
它不必是完全相同的对象,它只需要看起来与外部观察者相同。 如果将所有数据从一个对象复制到另一个对象,它将完成相同的任务。 public SmartForm(string loadCode) { _loadCode = loadCode; SmartForms smartForms = new SmartForms(_loadCode); this.IdCode = smartForms[0].IdCode; this.Title = smartForms[0].Title; ...
-
C#中的工厂模式实现(Factory Pattern implementation in C#)[2023-12-14]
这不是工厂模式。 一个工厂总是会有一些构造逻辑,至少有一个new 。 这就是工厂的想法:调用者不必担心如何创建对象。 这是一个单身存储库。 所以首先,不要使用数组,而应该有一个类型索引字典。 private static Dictionary_singletons = new Dictionary (); 之后,你不需要一个注册方法。 当你检索单身人士时,字典应该被自动填充。 现在我想你的Feed类有一个没有参数的默认构造函数。 在这种情况下,您可以直接从抽 ... -
回应似乎没有......你只是梦想着。 来自https://stackoverflow.com/a/14343648/613130 : 问:创建构造函数(?)以从缓存中检索对象,如果为null则重新创建 答:您无法创建执行此操作的构造函数。 构造函数始终创建一个新对象。 而是,创建一个静态工厂方法: 请注意,肯定可以使用Fody (一种能够修改汇编后编译的工具)来创建一个插件,将直接的new Foo()替换为FooProxy.Create() The response seems to be no.... ...
-
强制使用工厂(Force the use of a factory)[2021-05-04]
这是一个比我之前的评论更简单的方案。 只需在私有(但共享)范围内定义GNode类,这样就可以调用构造函数的唯一位置,并重置.constructor属性,使其不会泄漏: const GTree = (function() { class GNode { constructor() { } someOtherMethod() { console.log("someOtherMethod"); } ... -
创建ac#factory(Creating a c# factory)[2024-03-09]
我想你在第二部分描述工厂模式。 第一部分不是因为它依赖于调用者知道如何构建所需的对象。 在您的示例中, DateScheduleBuilderFactory将能够知道如何解释request对象中的信息并返回从DateScheduleBuilder派生的对象。 简而言之,就像上面的Johm Dom所说的那样。 你已经在那里...... I think you are describing the factory pattern in the second part. The first part is not ...